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 계정에 로그인하거나 계정을 새로 만드십시오.