http://www.mathworks.com/matlabcentral/newsreader/view_thread/316186
MATLAB Central Newsreader  ordinary differential equations
Feed for thread: ordinary differential equations
enus
©19942014 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Mon, 23 Jan 2012 14:10:09 +0000
ordinary differential equations
http://www.mathworks.com/matlabcentral/newsreader/view_thread/316186#864517
Pag Max
I have a set of ode something like<br>
<br>
x={x1,x2}<br>
<br>
x1_dd=f(x2_dd)<br>
and<br>
x2_dd=g(x1_dd)<br>
<br>
While this can be solved using standard ode45 prodcedure such as<br>
<br>
dx(1)=x(2);<br>
dx(2)=f(dx(4))<br>
dx(3)=x(4);<br>
dx(4)=g(dx(2))<br>
<br>
I am not sure if it is right from numerical methods perspective because I have LHS of second equation in RHS of first and vice versa. <br>
<br>
Any thoughts on this would be appreciaetd.

Mon, 23 Jan 2012 16:09:35 +0000
Re: ordinary differential equations
http://www.mathworks.com/matlabcentral/newsreader/view_thread/316186#864549
Torsten
On 23 Jan., 15:10, "Pag Max" <tismarkhanNOS...@gamil.com> wrote:<br>
> I have a set of ode something like<br>
><br>
> x={x1,x2}<br>
><br>
> x1_dd=f(x2_dd)<br>
> and<br>
> x2_dd=g(x1_dd)<br>
><br>
> While this can be solved using standard ode45 prodcedure such as<br>
><br>
> dx(1)=x(2);<br>
> dx(2)=f(dx(4))<br>
> dx(3)=x(4);<br>
> dx(4)=g(dx(2))<br>
><br>
> I am not sure if it is right from numerical methods perspective because I have LHS of second equation in RHS of first and vice versa.<br>
><br>
> Any thoughts on this would be appreciaetd.<br>
<br>
<br>
Use ode15i for your system of 4 equations from above.<br>
<br>
Best wishes<br>
Torsten.

Mon, 23 Jan 2012 21:37:50 +0000
Re: ordinary differential equations
http://www.mathworks.com/matlabcentral/newsreader/view_thread/316186#864564
Roger Stafford
"Pag Max" wrote in message <jfjpo1$1bp$1@newscl01ah.mathworks.com>...<br>
> I have a set of ode something like<br>
> <br>
> x={x1,x2}<br>
> <br>
> x1_dd=f(x2_dd)<br>
> and<br>
> x2_dd=g(x1_dd)<br>
> .......<br>
         <br>
In the two equations, "x2_dd=g(x1_dd)" and "x1_dd=f(x2_dd)", either 'f' and 'g' are inverses of one another or they are not. If the first is true, then there is not sufficient information present to solve the differential equations. You would have in effect only one equation with two unknowns. A ridiculous example of this would be:<br>
<br>
dx/dt = 2*dy/dt<br>
dy/dt = 1/2*dx/dt<br>
x(0) = 3<br>
y(0) = 2<br>
<br>
Now solve for x(t) and y(t). As you can easily see, there is a vast infinitude of possible solutions since dy/dt could be any function of t whatever, as long as dx/dt were twice that.<br>
<br>
On the other hand if 'f' and 'g' are not inverses of one another, there is presumably only one or at least only a finite set of constant number pairs that are possible values for x1_dd and x2_dd, in which case you are dealing with a trivial problem of linear functions of the independent variable where the derivatives are constants.<br>
<br>
In neither of the above situations is the use of 'ode' functions appropriate.<br>
<br>
Roger Stafford

Tue, 24 Jan 2012 04:56:10 +0000
Re: ordinary differential equations
http://www.mathworks.com/matlabcentral/newsreader/view_thread/316186#864630
Pag Max
Thanks Roger, <br>
No f and g are not inverse of each other but I realize I can reframe my problem<br>
as<br>
x2_dd=inv_f (x1_dd)<br>
and<br>
x1_dd=inv_g(x2_dd), <br>
<br>
This was confusing me but I guess you are right, ode is probably not appropriate. What about ode15i as Torsten suggested. Can this be treated as implicit ode. <br>
<br>
<br>
"Roger Stafford" wrote in message <jfkjve$8b4$1@newscl01ah.mathworks.com>...<br>
> "Pag Max" wrote in message <jfjpo1$1bp$1@newscl01ah.mathworks.com>...<br>
> > I have a set of ode something like<br>
> > <br>
> > x={x1,x2}<br>
> > <br>
> > x1_dd=f(x2_dd)<br>
> > and<br>
> > x2_dd=g(x1_dd)<br>
> > .......<br>
>          <br>
> In the two equations, "x2_dd=g(x1_dd)" and "x1_dd=f(x2_dd)", either 'f' and 'g' are inverses of one another or they are not. If the first is true, then there is not sufficient information present to solve the differential equations. You would have in effect only one equation with two unknowns. A ridiculous example of this would be:<br>
> <br>
> dx/dt = 2*dy/dt<br>
> dy/dt = 1/2*dx/dt<br>
> x(0) = 3<br>
> y(0) = 2<br>
> <br>
> Now solve for x(t) and y(t). As you can easily see, there is a vast infinitude of possible solutions since dy/dt could be any function of t whatever, as long as dx/dt were twice that.<br>
> <br>
> On the other hand if 'f' and 'g' are not inverses of one another, there is presumably only one or at least only a finite set of constant number pairs that are possible values for x1_dd and x2_dd, in which case you are dealing with a trivial problem of linear functions of the independent variable where the derivatives are constants.<br>
> <br>
> In neither of the above situations is the use of 'ode' functions appropriate.<br>
> <br>
> Roger Stafford

Tue, 24 Jan 2012 07:52:10 +0000
Re: ordinary differential equations
http://www.mathworks.com/matlabcentral/newsreader/view_thread/316186#864642
Roger Stafford
"Pag Max" wrote in message <jfldla$nh4$1@newscl01ah.mathworks.com>...<br>
> Thanks Roger, <br>
> No f and g are not inverse of each other but I realize I can reframe my problem<br>
> as<br>
> x2_dd=inv_f (x1_dd)<br>
> and<br>
> x1_dd=inv_g(x2_dd), <br>
> <br>
> This was confusing me but I guess you are right, ode is probably not appropriate. What about ode15i as Torsten suggested. Can this be treated as implicit ode. <br>
        <br>
With 'f' and 'g' not inverses of each other, I'll give you an example to illustrate why it would be inappropriate to use any matlab 'ode' function to solve your problem.<br>
<br>
Suppose your differential equations are:<br>
<br>
dx/dt = f(dy/dt) = (dy/dt)^(1/3)<br>
dy/dt = g(dx/dt) = 1/(1+(dx/dt)^2)<br>
x(0) = 0<br>
y(0) = 0<br>
<br>
The solution to the first two equations can be found using 'roots'. Call dx/dt = u and dy/dt = v. We have<br>
<br>
v = 1/(1+u^2)<br>
u = v^(1/3)<br>
v = u^3<br>
u^3 = 1/(1+u^2)<br>
u^5+u^31 = 0<br>
u = roots([1,0,1,0,0,1])<br>
Only one root is real:<br>
dx/dt = u = .83761977482696<br>
dy/dt = v = u^3 = 1/(1+u^2) = .58767980285774<br>
<br>
These derivatives are both constant as t varies. Hence we can immediately conclude that<br>
<br>
x(t) = .83761977482696 * t<br>
y(t) = .58767980285774 * t<br>
<br>
without any reference to an 'ode' function. It would be absurd to use it for that purpose.<br>
<br>
The above is characteristic of all cases where 'f' and 'g' are not inverses of one another except that in some cases there may be more than one pair of roots to them, in which case the problem becomes indeterminate as to which pair is going to apply. In any case 'ode' remains entirely unneeded for a problem of this simplistic nature.<br>
<br>
Roger Stafford

Tue, 24 Jan 2012 09:45:09 +0000
Re: ordinary differential equations
http://www.mathworks.com/matlabcentral/newsreader/view_thread/316186#864650
Pag Max
Got it..<br>
This makes lot of sense..<br>
Thank you so much...<br>
<br>
"Roger Stafford" wrote in message <jflnva$mru$1@newscl01ah.mathworks.com>...<br>
> "Pag Max" wrote in message <jfldla$nh4$1@newscl01ah.mathworks.com>...<br>
> > Thanks Roger, <br>
> > No f and g are not inverse of each other but I realize I can reframe my problem<br>
> > as<br>
> > x2_dd=inv_f (x1_dd)<br>
> > and<br>
> > x1_dd=inv_g(x2_dd), <br>
> > <br>
> > This was confusing me but I guess you are right, ode is probably not appropriate. What about ode15i as Torsten suggested. Can this be treated as implicit ode. <br>
>         <br>
> With 'f' and 'g' not inverses of each other, I'll give you an example to illustrate why it would be inappropriate to use any matlab 'ode' function to solve your problem.<br>
> <br>
> Suppose your differential equations are:<br>
> <br>
> dx/dt = f(dy/dt) = (dy/dt)^(1/3)<br>
> dy/dt = g(dx/dt) = 1/(1+(dx/dt)^2)<br>
> x(0) = 0<br>
> y(0) = 0<br>
> <br>
> The solution to the first two equations can be found using 'roots'. Call dx/dt = u and dy/dt = v. We have<br>
> <br>
> v = 1/(1+u^2)<br>
> u = v^(1/3)<br>
> v = u^3<br>
> u^3 = 1/(1+u^2)<br>
> u^5+u^31 = 0<br>
> u = roots([1,0,1,0,0,1])<br>
> Only one root is real:<br>
> dx/dt = u = .83761977482696<br>
> dy/dt = v = u^3 = 1/(1+u^2) = .58767980285774<br>
> <br>
> These derivatives are both constant as t varies. Hence we can immediately conclude that<br>
> <br>
> x(t) = .83761977482696 * t<br>
> y(t) = .58767980285774 * t<br>
> <br>
> without any reference to an 'ode' function. It would be absurd to use it for that purpose.<br>
> <br>
> The above is characteristic of all cases where 'f' and 'g' are not inverses of one another except that in some cases there may be more than one pair of roots to them, in which case the problem becomes indeterminate as to which pair is going to apply. In any case 'ode' remains entirely unneeded for a problem of this simplistic nature.<br>
> <br>
> Roger Stafford