|
"Sean " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <hsead5$oit$1@fred.mathworks.com>...
> "Roman Tolmachev" <tolmachevroman@gmail.com> wrote in message <hse9h0$sh9$1@fred.mathworks.com>...
> > "Sean " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <hse58m$t0l$1@fred.mathworks.com>...
> > > "Roman Tolmachev" <tolmachevroman@gmail.com> wrote in message <hsduar$ff4$1@fred.mathworks.com>...
> > > > Hello everyone,
> > > > I need your help with such a question: I try to plot the solution for Lorenz system, but find that matlab's performance is extremely slow. I started the program yesterday at 19.00 and it is still calculating. I tried matlabpool to use second core, but it seems no result. Is it ok that such a simple program requires so much time? What would you do in that case?
> > > > Thanks in advance, the code is below.
> > > >
> > > > function lorplane(p1)
> > > > global r sigma b
> > > > sigma=10; b=8/3;
> > > > r=p1;
> > > > options=odeset('AbsTol',1e-6,'RelTol',1e-4);
> > > > xinit=sqrt(b*(r-1));
> > > > yinit=sqrt(b*(r-1));
> > > > zinit=(r-1);
> > > > [T,X]=ode45(@lorenzeqs,[0 50],[xinit yinit zinit],options);
> > > > plot(X(:,1),X(:,3))
> > > >
> > > > function dx=lorenzeqs(t,x);
> > > > global r;
> > > > sigma=10; b=8/3;
> > > > dx=zeros(3,1);
> > > > dx(1)=sigma*(x(2)-x(1));
> > > > dx(2)=r*x(1)-x(2)-x(1)*x(3);
> > > > dx(3)=x(1)*x(3)-b*x(3);
> > >
> > >
> > > What are you using for p1? It takes fractions of a second to run on any number <= 1.4. Apparently it diverges above that.
> >
> > Thanks for attention. According to the Lorenz system features, p1 can be bigger than 1.4, e.g. 13 or 24 and it should lead to different results, and it is my task actually to test different p1 from 10 and higher to obtain these results. I thought about Euler iterations method here, but I am not sure it will be faster...
>
> Try some of the other ode functions ode15s, ode23t etc. I tried these two and it spit back a result. The result appeared to be meaningless (10^162) but that's what it gave. Maybe there's something wrong with your Lorenz equation. Apparently there is some stiffness in this equation. I'm not familiar with it.
>
> Good Luck!
Also, according to this website:
http://planetmath.org/encyclopedia/LorenzEquation.html
Your lorenz equation is wrong. It might be a different variation of it, but running it with this equation provided meaningful plots at higher values!
should be:
function dx=lorenzeqs(t,x)
sigma=10;
b=8/3;
dx=zeros(3,1);
dx(1)=sigma*(x(2)-x(1));
dx(2)=x(1)*(28-x(3))-x(2);
dx(3)=x(1)*x(2)-b*x(3);
end
|