[odepkg] solution for decreasing time

View: New views
2 Messages — Rating Filter:   Alert me  

[odepkg] solution for decreasing time

by Denis-63 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I need to plot several trajectories of a solutions of ODE like here:
http://www.wam.umd.edu/~petersd/246/matlabauton.html

hold on
for a1=-7:2:5  
  for a2=-7:2:1    
    [ts,ys] = ode45(g,[0,4],[a1;a2]);
    plot(ys(:,1),ys(:,2))    
    [ts,ys] = ode45(g,[0,-4],[a1;a2]); % Doesn't work in octave
    plot(ys(:,1),ys(:,2))
  end
end
hold off

But ode45 doesn't work for decreasing time
[ts,ys] = ode45(g,[0,4],[a1;a2]); - works fine
[ts,ys] = ode45(g,[-4,0],[a1;a2]); - gives the same result as above
[ts,ys] = ode45(g,[0,-4],[a1;a2]); - doesn't work as it works in matlab

So I can plot only half of solution and trajectory is incomplete.
Also if a result grows too fast I couldn't plot the trajectory for specific
initial conditioins at all, because of error:

Solving has not been successful. The iterative integration loop exited at time
t = 1.523467 before endpoint at tend = 4.000000 was reached. This may happen
if the stepsize grows smaller than defined in vminstepsize. Try to reduce the
value of "InitialStep" and/or "MaxStep" with the command "odeset".

Could you fix solvers to make their behaviour more close to matlab one? Matlab
1) solves ODE for decreasing time and 2) shows only warning if a solution
becomes too big.

Thanks )

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Octave-dev mailing list
Octave-dev@...
https://lists.sourceforge.net/lists/listinfo/octave-dev

Re: [odepkg] solution for decreasing time

by Thomas Treichl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Denis Nikiforov schrieb:

> I need to plot several trajectories of a solutions of ODE like here:
> http://www.wam.umd.edu/~petersd/246/matlabauton.html
>
> hold on
> for a1=-7:2:5  
>   for a2=-7:2:1    
>     [ts,ys] = ode45(g,[0,4],[a1;a2]);
>     plot(ys(:,1),ys(:,2))    
>     [ts,ys] = ode45(g,[0,-4],[a1;a2]); % Doesn't work in octave
>     plot(ys(:,1),ys(:,2))
>   end
> end
> hold off
>
> But ode45 doesn't work for decreasing time
> [ts,ys] = ode45(g,[0,4],[a1;a2]); - works fine
> [ts,ys] = ode45(g,[-4,0],[a1;a2]); - gives the same result as above
> [ts,ys] = ode45(g,[0,-4],[a1;a2]); - doesn't work as it works in matlab
>
> So I can plot only half of solution and trajectory is incomplete.
> Also if a result grows too fast I couldn't plot the trajectory for specific
> initial conditioins at all, because of error:
>
> Solving has not been successful. The iterative integration loop exited at time
> t = 1.523467 before endpoint at tend = 4.000000 was reached. This may happen
> if the stepsize grows smaller than defined in vminstepsize. Try to reduce the
> value of "InitialStep" and/or "MaxStep" with the command "odeset".
>
> Could you fix solvers to make their behaviour more close to matlab one? Matlab
> 1) solves ODE for decreasing time and 2) shows only warning if a solution
> becomes too big.
>
> Thanks )

Hi Denis,

1) In general yes, but right now I'm very sorry that (at least) I don't have the
time to do it. But, can you provide a small example for a function 'g' with a
reference solution at t=-4 and the initial values needed?

2) What exactly do you mean here? If you are talkin' about the error that you've
posted then I would suggest to reduce "InitialStep" and/or "MaxStep"?!

   Thomas

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Octave-dev mailing list
Octave-dev@...
https://lists.sourceforge.net/lists/listinfo/octave-dev
LightInTheBox - Buy quality products at wholesale price