# How Can MATLAB's ODE45 Be Used to Solve Vector Differential Equations?

• swraman
In summary, the homework statement is a vector consisting of 2 errors and their derivatives. They are related by a matrix equation. The attempt at a solution does not involve using MATLAB, but instead involves understanding the equation and rewriting it in a more simplified form.
swraman

## Homework Statement

I have a Differential equation, it is in the form of a vector. It consists of 2 errors and their derivatives:

[e1 ; e1', e2 ; e2']

they are all related by:

$$\frac{d [e1 ; e1', e2 ; e2'] }{dt}$$ = [4x1 matrix] + [4x1 matrix]*e1 + [4x1 matrix]*e1' + [4x1 matrix]*e2 + [4x1 matrix]*e2' + [4x4 matrix]*[e1 ; e1', e2 ; e2']

## The Attempt at a Solution

I don't know how to input this into MATLAB for use with ODE45. All the matricies I have are constants, except for the e1, e2, and their derivatives. Can this be treated as a fourth order differential equation in Matlab even though it is 2 second order problems?

Any help appreciated.

Thanks

can you provide a few more details, I don't understand the represntation, but I can help you!

I have a Differential equation describing e1',e1'',e2',and e2''.
It is rather complicated so I photoed it here:

I have no idea how enter that into matlab.

Also, in this equation $$\delta$$ = $$\frac{L}{R}$$ - e1 - e1' - e2 - e2'. So that term has dependence on the vars e1 and e2 also.

This is a bit overwhelming for me, I don't know where to go. Any help appreciated!

Thanks

dont fret about the delta functon, its just delayed so that the input will be definted for the instant you are interested in!

you want to start by defining the 4, 4x1 vectors in your program:

say v1, v2, v3, v4

define the 4x4 matrix 'MMM' in the same fashion
your desired vector can be defined as:

E_solution = [e1 ; e1', e2 ; e2']

employing the correct matrix/vector multipliaction, you will reduce this differential equation problem to a linear algebra problem...

thsi is th ebeauty of MATLAB thi si sthe construct for which it is based on.

if you define the multiplicative factors in your pic as, for instance:

delta, psi_dot_des, sin_phi (not sure if these are functions somehow maybe)

you reduce your equation to somethig of the form:

dE_solution/dt = delta*v1 + psi_dot_des*v2 + sin_phi*v3 + MMM*E_solution

I think you can rearange this to be something of the form

dE/dt = MMM*E + AAA where AAA is the linear combination of the other terms...

so now you have something in matrix form and you can use the appriate inputs into the ode45 function... let me know ho wit goes, I need to go scan for my CT experiments this afternoon so I may not be able to get back to you right away

best of luck

## 1. What is Matlab and how is it used for solving differential equations?

Matlab is a high-level programming language and interactive environment used for numerical computation, data visualization, and algorithm development. It has built-in functions and libraries specifically designed for solving differential equations. Users can input the equations and parameters into Matlab and it will use numerical methods to solve them.

## 2. What types of differential equations can Matlab solve?

Matlab can solve a wide range of differential equations including ordinary differential equations (ODEs), partial differential equations (PDEs), and differential algebraic equations (DAEs). It also has the capability to solve systems of differential equations and boundary value problems.

## 3. What are some common numerical methods used for solving differential equations in Matlab?

Some common methods used in Matlab for solving differential equations include Euler's method, Runge-Kutta methods, and finite difference methods. These methods use numerical approximations to solve the equations rather than analytical solutions.

## 4. Can Matlab handle stiff differential equations?

Yes, Matlab has specialized solvers for stiff differential equations, which are equations that contain both fast and slow varying components. These solvers use adaptive step sizes and other techniques to accurately solve the equations without sacrificing efficiency.

## 5. Are there any limitations to using Matlab for solving differential equations?

While Matlab is a powerful tool for solving differential equations, it does have some limitations. It may struggle with very large systems of equations or problems with highly nonlinear behavior. In these cases, it may be necessary to use other software or techniques to solve the equations.

• Engineering and Comp Sci Homework Help
Replies
1
Views
1K
• Engineering and Comp Sci Homework Help
Replies
2
Views
1K
• Mechanical Engineering
Replies
3
Views
2K
• Engineering and Comp Sci Homework Help
Replies
2
Views
1K
• Precalculus Mathematics Homework Help
Replies
3
Views
1K
• Calculus and Beyond Homework Help
Replies
7
Views
2K
• Calculus and Beyond Homework Help
Replies
3
Views
780
• Engineering and Comp Sci Homework Help
Replies
1
Views
2K
• Introductory Physics Homework Help
Replies
5
Views
3K
• Engineering and Comp Sci Homework Help
Replies
16
Views
8K