Simulink Easter Eggs
With Easter just a few days away, we thought it was a good time to share some little known Easter eggs that exist in Simulink.
Philosophical Annotations
Many MATLAB users are aware of the interesting response you can get by typing WHY in the command prompt. But, did you know that Simulink Annotations offer similar behavior? Fans of a certain science fiction series might appreciate this one.
Appreciation for Irrational Numbers that are Homophones for Baked Goods
We have a deep appreciation for pi (and for pie). I was recently told that if you string enough of the digits of pi in a series of gain blocks, you could achieve some interesting results. That sounded like a lot of work, so I wrote a script using add_block to construct the model. In the end, the result was definitely interesting.
% Initialize based on current selected block lastBlock = get_param(gcb,'Name'); blockPos = get_param(gcb,'Position'); for ii = 1:100 % Calculate next digit of pi lastDigit = rem(floor(pi*power(10,ii-1)),10); % Generate a new block blockPos = blockPos+[50 0 50 0]; newBlock = sprintf('Gain%d',ii); newGain = add_block('built-in/Gain',[gcs,'/',newBlock],'Position',blockPos); % Populate value and connect set_param(newGain,'Gain',num2str(lastDigit)) add_line(gcs,[lastBlock,'/1'],[newBlock,'/1']) lastBlock = newBlock; end
Little-known Support Package
There are many Support Packages available through the Add-Ons button in the MATLAB toolstrip. Some users have stumbled upon the Advanced Support Package. We can’t reveal the installation steps, but you can see it in action below.
Wait, What Day is it Today?
When you save your Simulink model, the time and date are stored in the Model Properties. Did you also know that on certain dates, an additional comment gets added to the Model History? For example, here’s what you might see if you saved your model today, April 1st.
Now It's Your Turn
What are the best April Fools jokes you've played using Simulink?
- Category:
- Fun
Comments
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.