Path: news.mathworks.com!not-for-mail
From: "Steven Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: dy/dt value from ode45 solver
Date: Thu, 20 Aug 2009 12:55:24 -0400
Organization: The MathWorks, Inc.
Lines: 49
Message-ID: <h6jv5k$mfq$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>
Reply-To: "Steven Lord" <slord@mathworks.com>
NNTP-Posting-Host: lords.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1250787316 23034 172.31.44.65 (20 Aug 2009 16:55:16 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 20 Aug 2009 16:55:16 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
Xref: news.mathworks.com comp.soft-sys.matlab:564814



"Md. Shahriar Karim" <karim.shahriar@gmail.com> wrote in message 
news: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,

After reading Yi's response, I think I misread your question and I _think_ 
it's simpler than I'm making it out to be, but I'm going to ask a 
clarification question to make sure I understand what you're asking for.

    Are you trying to evaluate dy/dt at the times t and solution values y 
returned by ODE45?

If so, just call your ODE function with those t and y inputs.  Depending on 
how you wrote your ODE function, you may need to loop over the elements of 
the time vector and the rows of the solution vector.  Remember, ODE45 
requires a function that accepts t and y values and returns dy/dt evaluated 
at those values -- which is precisely what I think you're looking for.

If that's not what you're looking for, please explain in a bit more depth 
what you're trying to do.

-- 
Steve Lord
slord@mathworks.com