Working in technical support, I receive a lot of models. Sometimes I am impressed by very clever implementations, but sometimes the only thing coming to my mind is "Why is he doing that?". Here are a few examples I want to share with you.
What time is it?
It is not necessary to add blocks to your model. Instead, open the simulation Configuration Parameter and go to the Data Import/Export pane.
Abusing the MATLAB Function block
I saw this construct in a model recently:
Yes... this works. But using the MATLAB Function block for a task that a basic block can do makes your life more complicated than it should be. In this case, I recommend using the Demux block if you want to extract all the elements of the vector and Selector blocks if you only want a subset. It is faster to setup and does not require code generation when you hit play.
How do you Delay?
When searching for a block to delay a signal, here is what you find:
However, when enabling the sample time colors and looking a bit closer at the results, you quickly notice that the Integer Delay block is discrete, while the Transport Delay is continuous.
Make sure you use the right block for your situation. The Integer Delay should be used for discrete signals, and the Transport Delay for continuous signals.
Now it's your turn
Do you encounter situations where you are not sure if you are using the right block? Have you ever been told you were using the wrong block? Please share with us by leaving a comment here.
댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.