Simulink Vs Matlab Diff. Equations.

  • Follow


Guys, this is my first post!

My question is why do i get slightly different results when computing differential equations using matlab or simulink. 

Here is my equation.

2nd derivative v * 1st derivative v * v

I am using 4th order Runge Kutta in both with fixed time step of 0.5. Qualitatively they are almost identical but not quite. Surely they should be the same. Am I doing something wrong.

function [dxy] = diffxy(t, xy)
x1 = xy(1);
xdot1 = xy(2);
xdot1 = xdot1;
xdoubledot1 = - xdot1 - x1;
dxy = [xdot1; xdoubledot1];
0
Reply thomas 11/27/2010 7:48:04 PM

Guys ignore this, have tried with other solvers, A OK. Must have slightly diff. implementations of RK 4.








"thomas " <thomashenryalderson@hotmail.com> wrote in message <icrn9k$osb$1@fred.mathworks.com>...
> Guys, this is my first post!
> 
> My question is why do i get slightly different results when computing differential equations using matlab or simulink. 
> 
> Here is my equation.
> 
> 2nd derivative v * 1st derivative v * v
> 
> I am using 4th order Runge Kutta in both with fixed time step of 0.5. Qualitatively they are almost identical but not quite. Surely they should be the same. Am I doing something wrong.
> 
> function [dxy] = diffxy(t, xy)
> x1 = xy(1);
> xdot1 = xy(2);
> xdot1 = xdot1;
> xdoubledot1 = - xdot1 - x1;
> dxy = [xdot1; xdoubledot1];
0
Reply thomas 11/27/2010 8:11:04 PM


Nope, right the first time, why is this? Only slightly differing results.


"thomas " <thomashenryalderson@hotmail.com> wrote in message <icrn9k$osb$1@fred.mathworks.com>...
> Guys, this is my first post!
> 
> My question is why do i get slightly different results when computing differential equations using matlab or simulink. 
> 
> Here is my equation.
> 
> 2nd derivative v * 1st derivative v * v
> 
> I am using 4th order Runge Kutta in both with fixed time step of 0.5. Qualitatively they are almost identical but not quite. Surely they should be the same. Am I doing something wrong.
> 
> function [dxy] = diffxy(t, xy)
> x1 = xy(1);
> xdot1 = xy(2);
> xdot1 = xdot1;
> xdoubledot1 = - xdot1 - x1;
> dxy = [xdot1; xdoubledot1];
0
Reply thomas 11/27/2010 10:05:05 PM

2 Replies
481 Views

(page loaded in 0.018 seconds)

Similiar Articles:













7/22/2012 12:53:08 PM


Reply: