MATLAB Answers

pouya jamali

How to solve ODE with Simulink?

Asked by pouya jamali
on 19 Oct 2011

I have an Ordinary Differential Equation as follow: dv/dt-av^2-b=0 where a and b are constants how to solve this equation using Simulink?



No products are associated with this question.

1 Answer

Answer by Fangjun Jiang
on 19 Oct 2011

Your equation can be written as dv/dt=a*v*v+b.

Drag an Integrator block, the input is dv/dt, the output is v, use Constant block, Product block and Sum block to construct the equation and then you can run the simulation to solve the equation.

The solution is only numerical. You can vary the value of a, b and the initial value of v to see the effect.


I do that but the result is :
Derivative input 1 of 'test/Integrator' at time 0.78539826055126438 is Inf or NaN. Stopping simulation. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)
What can I do with this error?

That probably means that based on your value of a, b, initial value of v and the simulation step size, the simulation is unstable, or it's a fact that the value of v is becoming ruminatively large. What is your a, b, initial v and simulation step size?

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!