This week I feel like an archaeologist who just dug out a new species of dinosaur! I discovered the Differential Equation Editor...
Differential Equation Editor
Try typing dee in MATLAB. This will launch an example model that looks like:
If you open one of the demo and double-click on the block, you will see a nice little user interface:
In this interface, you can type any equation you want, using the format of the Fcn block.
When I first saw this model and user interface, I thought "This thing looks really old, has it always been there, unnoticed?". So I looked into our source code history and found out this example ships with Simulink and has been untouched since the middle of the 90's!
How does that work?
I strongly encourage you to look under the mask and observe how this block is implemented. It is a pretty good example of how to create models programmatically. Once you click the rebuild button in the user interface, functions like delete_block, add_block and add_line draw the differential equation in a systematic manner.
For any set of equation, the resulting model will look like this, where one Fcn block is used for each state equation and for each output equation:
To help you visualize it better, I formatted the above model to make it easier to read:
Now it's your turn
Give this cute little example a try and let us know what you think by leaving a comment here.
コメントを残すには、ここ をクリックして MathWorks アカウントにサインインするか新しい MathWorks アカウントを作成します。