From: Rady on
Hello,

I am using ode45 to solve a system of dfq's, and the problem is that it takes too long and the data is not plotted, and I know there is data. What can resolve that?

Thank you
From: Steven_Lord on


"Rady " <bergen310(a)hotmail.com> wrote in message
news:i3eq7k$9fn$1(a)fred.mathworks.com...
> Hello,
> I am using ode45 to solve a system of dfq's, and the problem is that it
> takes too long and the data is not plotted, and I know there is data. What
> can resolve that?
>
> Thank you

Try a stiffer solver.

http://www.mathworks.com/company/newsletters/news_notes/clevescorner/may03_cleve.html

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

From: Rady on
"Steven_Lord" <slord(a)mathworks.com> wrote in message <i3f699$7kh$1(a)fred.mathworks.com>...
>
>
> "Rady " <bergen310(a)hotmail.com> wrote in message
> news:i3eq7k$9fn$1(a)fred.mathworks.com...
> > Hello,
> > I am using ode45 to solve a system of dfq's, and the problem is that it
> > takes too long and the data is not plotted, and I know there is data. What
> > can resolve that?
> >
> > Thank you
>
> Try a stiffer solver.
>
> http://www.mathworks.com/company/newsletters/news_notes/clevescorner/may03_cleve.html
>
> --
> Steve Lord
> slord(a)mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com



Hello, thank you for the response. I tried ode23s, and now I get a lot of error codes...
Here it is, any help would be greatly appreciated:
Error Code:
??? In an assignment A(I) = B, the number of elements in B and
I must be the same.

Error in ==> react at 30
dydt1(3)=k*cos(A3).*C+y1*(A1.^2+A2.^2);

Error in ==> odearguments at 110
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.

Error in ==> ode23s at 188
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...

Error in ==> dydt1 at 6
[t,y]=ode23s('react', tspan ,x0);

Why would that be?

The original code is:
tspan=linspace(0,1,0.0003);
x0=[0 0 0];
[t,y]=ode23s('react', tspan ,x0);

Thank you
From: Torsten Hennig on
> "Steven_Lord" <slord(a)mathworks.com> wrote in message
> <i3f699$7kh$1(a)fred.mathworks.com>...
> >
> >
> > "Rady " <bergen310(a)hotmail.com> wrote in message
> > news:i3eq7k$9fn$1(a)fred.mathworks.com...
> > > Hello,
> > > I am using ode45 to solve a system of dfq's, and
> the problem is that it
> > > takes too long and the data is not plotted, and I
> know there is data. What
> > > can resolve that?
> > >
> > > Thank you
> >
> > Try a stiffer solver.
> >
> >
> http://www.mathworks.com/company/newsletters/news_note
> s/clevescorner/may03_cleve.html
> >
> > --
> > Steve Lord
> > slord(a)mathworks.com
> > comp.soft-sys.matlab (CSSM) FAQ:
> http://matlabwiki.mathworks.com/MATLAB_FAQ
> > To contact Technical Support use the Contact Us
> link on
> > http://www.mathworks.com
>
>
>
> Hello, thank you for the response. I tried ode23s,
> and now I get a lot of error codes...
> Here it is, any help would be greatly appreciated:
> Error Code:
> ??? In an assignment A(I) = B, the number of
> elements in B and
> I must be the same.
>
> Error in ==> react at 30
> dydt1(3)=k*cos(A3).*C+y1*(A1.^2+A2.^2);
>
> Error in ==> odearguments at 110
> f0 = feval(ode,t0,y0,args{:}); % ODE15I sets
> args{1} to yp0.
>
> Error in ==> ode23s at 188
> [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0,
> odeArgs, odeFcn, ...
>
> Error in ==> dydt1 at 6
> [t,y]=ode23s('react', tspan ,x0);
>
> Why would that be?
>
> The original code is:
> tspan=linspace(0,1,0.0003);
> x0=[0 0 0];
> [t,y]=ode23s('react', tspan ,x0);
>
> Thank you

And where do we find 'react' ?

Best wishes
Torsten.
From: Rady on
Here is react.m Hope you can help
function dydt1 = react (t,y)
y1=6;
k=2;
L=1;
z=0:0.00011999:1;
t=z/L;
c=0:0.0003:2.5;
a=4*k;
s=y1/a;
m=1./(1+(s.*c).^2).^0.5;
cons=((2.*k)./m);
[sn0,cn0,dn0]=ellipj(cons,m);
t(8335)=[];
A1=(c.*((dn0.*(t-1)+1)./(2.*dn0.*(t-1)))).^0.5;
A2=(c.*((1-dn0.*(t-1))./(2.*dn0.*(t-1)))).^0.5;
psi=0:0.0003:2.5;
% dydt1 = zeros(size(y));
% disp (size(dydt1))
% size(A1)
% size(A2)

C=(A2./A1)+(A1./A2);
R=(A1.^2+A2.^2);
% A1=y(1);
% A2=y(2);
% psi=y(3);
% dydt1(1)=k*A2.*sin(psi);
% dydt1(2)=k*A1.*sin(psi);
% dydt1(3)=k.*cos(psi).*C+y1.*R;

dydt1=[(k*A2.*sin(psi)).';(k*A1.*sin(psi)).';(k.*cos(psi).*C+y1.*R).'];
disp(dydt1)