The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: (yet unsolved) how to Solve coupled ODEs
Replies: 4   Last Post: Feb 13, 2013 4:11 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 1,717
Registered: 11/8/10
Re: (yet unsolved) how to Solve coupled ODEs
Posted: Feb 13, 2013 4:11 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Henry" wrote in message <kfeavo$2f$>...
> I modified the code to:
> tspan = linspace(1, 2,100);
> y = 0.0001*ones(1,200);
> [T,sols] = ode45(@yprime, tspan,y);
> and
> dyds = [dyds1' ; dyds2'];
> and it now runs, thanks.
> But I have this question: My odes are time-independent, function of "s" which is a distance, but since the ode45 will not work without a tspan, I came up with an arbitrary tspan. It looks as if ode45 interprets that "s" is a time? I'm confused as to how interpret the result of the routine which has dimensions of 100x200. I was expecting 1 x 200, i.e. independent of time.
> thanks

By the way:
I suspect that you want to set different values of a,b,c and d for different values of s and solve for only _two_ solutions y(1) and y(2). That's not what you do in your code above.
You will have to use MATLAB's interp1 function to get values for a,b,c and d at the distance s where the solver needs the values of the derivatives dyds(1) and dyds(2).

Or do you want to make a parameter study, i.e. different solutions for different
combinations of the parameters a,b,c and d ? Then your code above
is also incorrect because you always refer to y(1) and y(2) in the evaluation of the derivatives, thus the solution for only the _first_ parameter set.

We need more information about your underlying problem in order to give
useful advice.

Best wishes

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.