Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sampling issue, or something else? Simulation does not match graph ode

Status
Not open for further replies.

luck764

Chemical
Jan 20, 2011
2
US
Was wondering if anyone has had this problem -
take a simple ode and solve it using the classical method.
Graph your output.

Go ahead and use simulink to layout and solve by way of simulation and compare the two outputs.

What I have noticed is simulinks scope output will not match the equation during the first few time periods.

Just to check my math - I went ahead and solved the ode within matlab using a solver and graphed it. The output matched my hand calc, but not the simulink output (i used the same solver in matlab and simulink).

I'm guessing this has to do with the response time of the simulation (simulink can not react fast enough to acurately show the output curve), but im not sure how to possibly slow the sim down enough (or add enough points) to prove this.

Anyone else notice this? If so were you able to find a way to have the simulink output match?

Here's the ODE i'm playing with (it's a pretty simple one): ?2y/?t + 6 ?y/?t + 5 y = ?f/?t + 2f

 
Replies continue below

Recommended for you

Modelling differential equations in simulink can be done in several different ways, each of which has its own disadvantages and will give different results. Be careful with initial velocities and so on.

Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376
 
It was when playing with the B.C's that I noticed this: I first solved at a=0, a'=0 and set both 1/s blocks to 0. Then for fun (yeah I know - there are better things to do when your board) I set my I.C.'s to a=0 and a'=1 and re solved; changing my blocks to match (0,1). That's when I noticed the curves to be off. I went back to (0,0) and looked carefully and noticed the curves were off as well (they are close to each other - so initially I did not pick up on it).


One thing to mention was that solveing the ode at ICs a=0 a'=1 seems to match simulink with 1/s blocks I.C.'s set to 0,0.

The curve will always "top out" at .4 by way of the equation, on or about 4t; I'm just stumped.

Thanks to all who have answered so far!
 
Try upping the simulation tolerance in Simulink. This can make a noticeable difference.

[peace]
Fe
 
Which exact solver do you use in Simulink and which in Matlab?
Maybe you are usisng a varibale step solver in Simulink
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top