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: Thu, 20 Aug 2009 04:09:03 +0000 (UTC)
Organization: EBL
Lines: 65
Message-ID: <h6ii8v$c0d$1@fred.mathworks.com>
References: <h6f14q$7a7$1@fred.mathworks.com> <h6f5pa$hct$1@fred.mathworks.com> <h6fikv$egv$1@fred.mathworks.com> <h6firi$red$1@fred.mathworks.com> <h6h1q8$sp5$1@fred.mathworks.com> <h6hgs7$9uf$1@fred.mathworks.com>
Reply-To: "Md. Shahriar Karim" <karim.shahriar@gmail.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1250741343 12301 172.30.248.35 (20 Aug 2009 04:09:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 20 Aug 2009 04:09:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1507044
Xref: news.mathworks.com comp.soft-sys.matlab:564648


Hi Cao,

Could you please explain the logic working here? Once I call the function again how does it give the dydt value? 

is it that if I call the function again, it's going to give us the value of dy2dt2?

Thanks,

Md. Shahriar Karim


"Yi Cao" <y.cao@cranfield.ac.uk> wrote in message <h6hgs7$9uf$1@fred.mathworks.com>...
> "Md. Shahriar Karim" <karim.shahriar@gmail.com> wrote in message <h6h1q8$sp5$1@fred.mathworks.com>...
> > Hi Steve,
> > 
> > Thanks for your help so far. However, I am totally unsure from the below part--
> > 
> > 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.
> > 
> >  sol=ode45(@steadystate, [0:0.1:10000], y0);
> > 
> > once I do the above, I get my all variables value  after solving the ODEs..variables are..B C D ..etc.
> > 
> > Now from this I am told to use the DEVAL   on "sol", it gives me the values of my variables B,C,D...but I was needed the "dy/dt...the slope values.  
> > 
> > Now, I am supposed to subtract my desired "dy/dt"..say 0.00001 from DEVAL output which is my variables values? Once this is done, I do FZERO on the result I get after subtraction....this is what I was told.
> > 
> > Could you please clarify how am I getting dy/dt out of the whole process? I am quite confused at this stage. Thanking you,
> > 
> > Md. Shahriar Karim
> > 
> > 
> > 
> > "Steven Lord" <slord@mathworks.com> wrote in message <h6firi$red$1@fred.mathworks.com>...
> > > 
> > > "Md. Shahriar Karim" <karim.shahriar@gmail.com> wrote in message 
> > > news:h6fikv$egv$1@fred.mathworks.com...
> > > > 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);
> > > 
> > > Try replacing the string input with a function handle to your function and 
> > > use the second of those syntaxes..
> > > 
> > > -- 
> > > Steve Lord
> > > slord@mathworks.com 
> > > 
> 
> Actually, after you got the solution to the ODE, just call the function again you can get dy/dt, i.e.
> 
> [t, y]=ode45('steadystate', [0:0.1:10000], y0);
> dydt = steadystate(t,y);  %if your function is vectorized. Alternatively
> 
> dydt=y;
> for k=1:numel(t)
>  dydt(k,:)=steadystate(t(k),y(k,:));
> end
> 
> HTH
> Yi