# Matlab and Solving DiffEQ's

1. Feb 11, 2009

### swraman

1. The problem statement, all variables and given/known data
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']

3. The attempt at a solution

I dont 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

2. Feb 11, 2009

### JoeBonasia

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

3. Feb 12, 2009

### swraman

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 dont know where to go. Any help appreciated!

Thanks

4. Feb 12, 2009

### JoeBonasia

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