ode 45 - different results with different coordinate set

1 visualizzazione (ultimi 30 giorni)
I G il 10 Set 2018
Commentato: Jan il 10 Set 2018
I am solving system of next equations:
function f=fun(z,p)
R=1; sig=1; beta=1;
%f(4)=(-f(2)*p(3)-f(3)*p(2)+(2-sig)*8*(-f(3)/R-(f(2)/p(1)-p(2)*f(1))/(p(1).*p(1)*R.*R))/sig -f(1)*p(4))/p(1);
f(4)=(-f(2)*p(3)-f(3)*p(2)+(2-sig)*8*(-f(3)/R-f(2)/p(1)+p(2)*f(1)/(p(1).*p(1)))/(sig.*R.*R) -f(1)*p(4))/p(1);
with ode45 function. When I call it with this command:
[zv,pv]=ode45(@fun,[1 0],[1;0;0;0])
where my coordinate is going from 0 to 1, and appropriate initial conditions at coordinate 1 are: 1;0;0;0 I got good results. But when I change my code where I am calling my function with this one:
[zv,pv]=ode45(@fun,[0 1],[7.5;0;0;0])
where my coordinate is going from 0 to 1, and appropriate initial conditions at coordinate zero are 7.5;0;0;0 I got something what is not ok and not even similar with the first results, where I plot this:
Why is this happening when I tried to get results for the same case, just from different sides?
  1 Commento
Jan il 10 Set 2018
where my coordinate is going from 0 to 1
In the line [zv,pv]=ode45(@fun,[1 0],[1;0;0;0]) the time goes from 1 backward to 0. Do you mean this time with "coordinate from 0 to 1"?
You integrate a function one time over the time from 1 to 0 starting from [1,0,0,0] and another time over 0 to 1 starting from [7.5,0,0,0]. Of course you get completely different solutions. Why do you consider the second one as "not okay"? Of course the result is correct numerically, so I assume your expectations are the problem.

Accedi per commentare.

Risposte (0)




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by