Covert differential equation into a system of 1st order ODE?

In summary, the conversation discusses converting a second-order differential equation into a system of first-order equations in order to solve it using MATLAB's ode23 or ode45. The steps involved in converting and solving the equation are outlined, including the use of Maple to obtain the solution. The final MATLAB code for solving the equation is also provided.
  • #1
nufeng
6
0
How to covert this differential equation into a system of one order ODE?
(require covert the equation into a system of 1st-order equations and solve by using ode23 in matlab)

x^2*y''-2*x*y'+2*y = 0;
y(1) = 4; y'(1)=0;
solve for y(x)

I tried to convert it
get

X' = AX
in which
X = [y, z]'
A = [0, 1; 2/x^2, 2/x];

But x exists in A, which cannot solve by dsolve in Matlab.
 
Physics news on Phys.org
  • #2
You have left out steps in your reasoning.
You are mixing math and MATLAB notation: is the "prime" for derivative or transpose?

Try: $$X=\left [ \matrix{y\\z}\right ]$$ $$X^\prime=AX$$

What did you make ##z## equal to?
 
  • #3
Simon Bridge said:
You have left out steps in your reasoning.
You are mixing math and MATLAB notation: is the "prime" for derivative or transpose?

Try: $$X=\left [ \matrix{y\\z}\right ]$$ $$X^\prime=AX$$

What did you make ##z## equal to?

Thank you!
I know how to do it.
 
  • #4
Great to hear!
For the benefit of those poor souls who google to this page off a similar problem, and find my reply too obtuse perhaps you will post the answer?
 
  • #5
Simon Bridge said:
Great to hear!
For the benefit of those poor souls who google to this page off a similar problem, and find my reply too obtuse perhaps you will post the answer?

solve by MAPLE
first, solve 2nd order differential equation
ode2 := x^2*(diff(f(x), x, x))-2*x*(diff(f(x), x))+2*f(x) = 0
ics2 := (D(f))(1) = 9, f(1) = 4
dsolve([ode2, ics2])
answer is f(x) = 5*x^2-x

convert to a system of 1st ode
sys1ode := diff(y(t), t) = z(t), diff(z(t), t) = -2*y(t)/t^2+2*z(t)/t
ics := y(1) = 4, (D(y))(1) = 9
dsolve([sys1ode, ics])
solution: {y(t) = t*(5*t-1), z(t) = 10*t-1}

My original problem is I want to solve this problem by using ode23 or ode45 in MATLAB,
code:

% subfunction to define the equation
function f = funcENGM801(t,x);
A =[0,1;-2/(t+1)^2,2/(t+1)]; % here I change t to t+1
f = A*x ;

% main function
format longEng
tspan = [0: 0.01: 1];
x0 = [4,9];
[t,x] = ode45('funcENGM801', tspan, x0);
 
  • #6
Thank you :)
 

1. What is a covert differential equation?

A covert differential equation is a type of mathematical equation that involves the derivatives of one or more variables with respect to one or more independent variables. The equation is referred to as "covert" because it is not explicitly written in the form of a differential equation, but rather as a function of the derivatives.

2. Why is it important to convert a differential equation into a system of 1st order ODE?

Converting a differential equation into a system of 1st order ODE allows for easier analysis and solution of the equation. It also allows for the use of numerical methods, such as Euler's method, to approximate the solution. Additionally, many real-world problems can be modeled using systems of 1st order ODEs, making it a useful tool in a variety of scientific fields.

3. What are the steps involved in converting a differential equation into a system of 1st order ODE?

The first step is to identify the dependent variable and its derivatives in the original equation. Then, create new variables for each derivative, making the original dependent variable the first derivative. Finally, rewrite the original equation in terms of the new variables to create a system of 1st order ODEs.

4. Can any differential equation be converted into a system of 1st order ODE?

Yes, any differential equation can be converted into a system of 1st order ODEs. However, the process may be more complex for certain types of equations, such as partial differential equations.

5. How is the solution to a system of 1st order ODEs different from the solution to a single differential equation?

The solution to a system of 1st order ODEs is a set of functions, rather than a single function as in the case of a single differential equation. Each function represents the solution for one of the variables in the system. Additionally, the solution to a system of 1st order ODEs may involve initial conditions for each variable, whereas a single differential equation typically has one set of initial conditions.

Similar threads

  • Differential Equations
Replies
2
Views
1K
  • Differential Equations
Replies
2
Views
987
  • Differential Equations
2
Replies
52
Views
814
Replies
3
Views
791
  • Differential Equations
Replies
2
Views
2K
Replies
2
Views
2K
  • Differential Equations
Replies
3
Views
2K
Replies
1
Views
2K
  • Differential Equations
Replies
3
Views
1K
  • Differential Equations
Replies
7
Views
2K
Back
Top