How to solve ODE

Hello,
I have following nonlinear ODE-System: G(x)*x'=0
How can I solve this ODE-System with respect to x'=f(x)
so I need f(x)...
Thank you!

4 Kommentare

Star Strider
Star Strider am 28 Jul. 2012
You have a homogeneous differential equation. These are not ususual. What is ‘G(x)’ and what are the initial conditions?
John Miller
John Miller am 28 Jul. 2012
Bearbeitet: John Miller am 28 Jul. 2012
G(x) is a mxn Matrix with elements which are nonlinear functions with respect to x (x is a n dimensional vector x=[x1 x2 x3 x4 ... xn]).
The initial conditions are x0=[a 0] where "a" has the dimension n-1. And I have another condition: norm(x',2)=1 so the 2-norm of x' is equal to 1.
And I want to transform it into the standard form of a ODE x'=f(x) to solve it for example with ode45(). All MATLAB ODE solvers solve systems of equations in the form y′ = f(t,y) or M(t,y)y′ = f(t,y)but M must be a square matrix but my G(x) is not square it is m x n
Hope someone you can help. Thank You very much.
Star Strider
Star Strider am 29 Jul. 2012
Bearbeitet: Star Strider am 29 Jul. 2012
The ODE solvers don't have to have a square matrix argument, but the matrix argument does have to have as many rows as it has orders of derivatives, so that it is set up as a system of first-order ODEs. So if it's a second-degree ODE it has to have two rows, third-degree, three, etc. It definitely doesn't have to be square. For instance, the spring-mass-damper system:
mx" = u - k*x' - k2*x, where: x' = dx/dt, x" = d^2x/(dt^2)
is defined for ode45 as:
xdot(1) = x(2);
xdot(2) = -x(1)*k(2)/m -x(2)*k(1)/m + u(t)/m;
and works fine. I don't know if the Symbolic Math Toolbox can format your equations for you (you can ask it and find out), but I suggest it because it avoids algebra errors. If not, you can do it with pencil and paper.
John Miller
John Miller am 29 Jul. 2012
" I don't know if the Symbolic Math Toolbox can format your equations for you (you can ask it and find out), "
How can I ask it? I have not much experience in MATLAB

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Star Strider
Star Strider am 29 Jul. 2012
Bearbeitet: Star Strider am 29 Jul. 2012

1 Stimme

I asked the Symbolic Math Toolbox and it suggested that I refer you to the odeToVectorField function: http://www.mathworks.com/help/toolbox/symbolic/odetovectorfield.html.
When I gave it this code for the ODE I listed above:
syms m x(t) u k1 k2
% Differential Equation: mx" = u - k1*x' - k2*x
[V,Y] = odeToVectorField(m*diff(x,2) == u - k1*diff(x,1) - k2*x)
it returned:
V =
Y[2]
-(k1*Y[2] - u + k2*Y[1])/m
Y =
x
Dx
The ‘V’ output is the argument you will give to your ODE function, and the ‘Y’ ouput are the substitutions it made. It assumes you know that on the left side of ‘V’ to put the vector:
Ydot(1)
Ydot(2)
if necessary, depending on how your format the equation you use as one of your ODE arguments. You don't have to, though. You can just give it the matrix. The ODE functions assume the rest.

4 Kommentare

John Miller
John Miller am 29 Jul. 2012
Bearbeitet: John Miller am 29 Jul. 2012
Hello, thank you, but I dont get it:
Here is my DGL System I want to convert to the form y'=f(y):
M=[9136229716628231438126217320496444781/12930036122327939895266372694835200000-(5463269850839619*exp((500*y(2))/13))/81129638414606681695789005144064 - (8252925342302273*exp((500*y(3))/13))/63134942003554394019855335424000 - (637519*y(2))/637500, 1 - y(1)*((52531440873457875*exp((500*y(2))/13))/20282409603651670423947251286016 + 19/637500) - y(1),-(8252925342302273*y(1)*exp((500*y(3))/13))/1641508492092414244516238721024;
283255240950587110655722044265577077/517201444893117595810654907793408000 - (8252925342302273*exp((500*y(2))/13))/63134942003554394019855335424000 - (5463269850839619*exp((500*y(3))/13))/81129638414606681695789005144064 - (102001*y(3))/102000, -(8252925342302273*y(1)*exp((500*y(2))/13))/1641508492092414244516238721024, 1 - y(1)*((52531440873457875*exp((500*y(3))/13))/20282409603651670423947251286016 + 1/102000) - y(1)];
M*y'=0 %now how can I convert that to y'=f(x)??
Star Strider
Star Strider am 29 Jul. 2012
Your matrix is not a set of differential equations the ODE solvers can deal with. Neither they nor I can figure out what you want to do.
You have a [2 x 3] matrix in nonlinear functions of [y(1), y(2), y(3)] if I visually parsed it correctly, but I cannot figure out where the y-vector came from or what it represents. Did your matrix start out as a third-degree differential equation?
I believe you need to go back to the Symbolic Math Toolbox with your original differential equation, then use ‘odeToVectorField’ as I did in my example to get a differential equation that will work with the ODE solvers.
If you are still having problems with it after that, post what you have already done here along with a description of the errors you got or the problems you had, and we will be glad to help you.
John Miller
John Miller am 30 Jul. 2012
Bearbeitet: John Miller am 30 Jul. 2012
"Did your matrix start out as a third-degree differential equation?" No
"but I cannot figure out where the y-vector came from or what it represents." y=[y(1); y(2); y(3)] are just the unknown variables like y1,y2,y3 or x,y,z or x1,x2,x3 y' is the first time derivative like y'=[dy1/dt; dy2/dt; dy3/dt]
Like I sad, I just want to bring the equation M*y'=0 ans M is like you sad: " You have a [2 x 3] matrix in nonlinear functions of [y(1), y(2), y(3)] " . And I want to bring this simple equation to the form y'=f(y) where f(y) is a vectorfield. Thats all I want to do.
Star Strider
Star Strider am 30 Jul. 2012
The fundamental problem is that because your ‘M’ matrix is [2 x 3] and you have three unknowns, you have an under-determined system. There is no unique solution. That is the reason I suggested that you go back to the Symbolic Math Toolbox and start over.
I suggest that to you again.

Melden Sie sich an, um zu kommentieren.

Gefragt:

am 27 Jul. 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by