Guy on Simulink

Simulink & Model-Based Design

Special Vintage: Differential Equation Editor

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:

Differential Equation Editor

If you open one of the demo and double-click on the block, you will see a nice little user interface:

Differential Equation Editor

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.

Differential Equation Editor

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:

Differential Equation Editor

To help you visualize it better, I formatted the above model to make it easier to read:

Differential Equation Editor

Now it's your turn

Give this cute little example a try and let us know what you think by leaving a comment here.

|
  • print

评论

要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。