Path: news.mathworks.com!not-for-mail
From: "Md. Shahriar Karim" <karim.shahriar@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: dy/dt value from ode45 solver
Date: Wed, 19 Aug 2009 00:57:03 +0000 (UTC)
Organization: EBL
Lines: 64
Message-ID: <h6fikv$egv$1@fred.mathworks.com>
References: <h6f14q$7a7$1@fred.mathworks.com> <h6f5pa$hct$1@fred.mathworks.com>
Reply-To: "Md. Shahriar Karim" <karim.shahriar@gmail.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1250643423 14879 172.30.248.37 (19 Aug 2009 00:57:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 19 Aug 2009 00:57:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1507044
Xref: news.mathworks.com comp.soft-sys.matlab:564332


Hi Steve,

DEVAL asks for a structure input. I also replaced 

[t, y]=ode45('steadystate', [0:0.1:10000], y0); part of my code  by 
sol=ode45('steadystate', [0:0.1:10000], y0);  

but it didn't solve the problem. Again structure problem.

My code works as follows--

.......
y0(1)=70; y0(2)=0; y0(3)=200;y0(4)=0; y0(5)=0;
.......
.......
[t, y]=ode45('steadystate', [0:0.1:10000], y0); % I am calling another function "steadystate" %  
or
% sol=ode45('steadystate', [0:0.1:10000], y0);  

function dydt = steadystate(t,y)
......
B  = y(1); C  = y(2); D = y(3);E  = y(4); M =y(5);
......
dydt(1)=... (differential Equation for B, C, D, E, M)
dydt(2)=...
.....
.....
dydt=dydt';

My target is to calculate the dy/dt value for  variable "C"and once dy/dt value is available, I can put the checking condition for the slope calculation and find out my steady-state time accordingly.

Please suggest something again. Thanks,

Md. Shahriar Karim





"Steven Lord" <slord@mathworks.com> wrote in message <h6f5pa$hct$1@fred.mathworks.com>...
> 
> "Md. Shahriar Karim" <karim.shahriar@gmail.com> wrote in message 
> news:h6f14q$7a7$1@fred.mathworks.com...
> > Hi,
> >
> > I just used ode45 to solve a set of differential equations and got value 
> > of my variables (say, y) plotted. How can I have the "dy/dt" value saved 
> > as well for each time step when I use ODE45 solver.
> 
> Call ODE45 and specify some output arguments (one if you want the SOL 
> solution struct array, two if you want t and y as individual vectors.)  Then 
> plot the results (using DEVAL if you're using the SOL struct array.)
> 
> > Actually, I am interested to find out the steady-state time using the 
> > above approach. I consider "dy/dt" as a slope for the y plot and would 
> > like to extract the time value for any given condition on Slope dy/dt.
> 
> Write a function to DEVAL the SOL struct array at a given time and subtract 
> that result from the desired dy/dt, then use FZERO on that function.
> 
> -- 
> Steve Lord
> slord@mathworks.com 
>