×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

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

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

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

(OP)
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

 

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

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: Eng-Tips.com Forum Policies  http://eng-tips.com/market.cfm?

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

(OP)
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!

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

Try upping the simulation tolerance in Simulink. This can make a noticeable difference.  

peace
Fe

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

Try use the same dt

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

Which exact solver do you use in Simulink and which in Matlab?
Maybe you are usisng a varibale step solver in Simulink

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources