Matlab ode45

  • MATLAB
  • Thread starter jacckko
  • Start date
  • #1
6
0
Hi!!

I have to solve the nonlinear equations of motion in the article (16) (17) (18).

I Trasform the system in a system of first order differential equations but i don't have the initial conditions. Is it possible to solve it with the ode45 matlab function?
 

Attachments

  • 2008.pdf
    695.2 KB · Views: 286

Answers and Replies

  • #2
272
0
Ode45 uses among others, the runge kutta routine which is a numerical integration scheme. So no, you cannot solve it in matlab without knowing the initial conditions.
 
  • #3
6
0
Thanks!

Suppose I have the initial conditions.

I solve the system in this way, tell me if it is write!!

I have a 3 dof system in heave, roll and pitch, of the second order.
I call y=[ heave position, heave velocity, roll position, roll velocity, pitch position, pitch velocity].

I call yd=[heave velocity, heave acceleration, roll velocity, roll acceleration, pitch velocity, pitch acceleration]

I rewrite the system in the form:

function yd=deriv(t,y)

yd(1)=y(2)
yd(2)=f(y,t)
yd(3)=y(4)
yd(4)=f(y,t)
yd(5)=y(6)
yd(6)=f(y,t)

The problem is that in f(y) compare other acceleration terms. Can I write the system in this way?

yd=zeros(6,1)

yd(1)=y(2)
yd(2)=f(t,y,yd)
yd(3)=y(4)
yd(4)=f(t,y,yd)
yd(5)=y(6)
yd(6)=f(t,y,yd)

I think if I know y is it possible. What do you think??

The second question is: to solve the system I only have to write

[t,y]=ode45('deriv',[t0 tf],y0)

Is it true? Or I have to study something related to singularities??

Thanks
 
  • #4
AlephZero
Science Advisor
Homework Helper
6,994
293
Skipping the mess of notation in the real equations, here's a simple example of what you need to do.

Suppose you have a 2nd order equation like
Ax'' + Bx' + Cx = D

To turn it into two 1st order equations, let y = x'

The equation then becomes
Ay' + By + Cx = D

So now you have two first order equations
x' = y
y' = (D - Cx - By)/A

The intial conditions give the starting values for x and y.

When your Matlab function is called, It is given some values of x and y (and also the time) and your function calculates the values of x' and y'.

Note, the important thing is not get confused about where to use x' and where to use y. They are mathematically identical, but in the numerical method they are two different quantities, and the fact that the numerical values are always equal is just happenstance.
 
  • #5
6
0
This is the way I have solved the system. Is it correct?
 

Attachments

  • function yd.pdf
    91.8 KB · Views: 294
  • #6
6
0
Another question.. How can I solve a system like this?
 

Attachments

  • function yd1.pdf
    93.5 KB · Views: 168
  • #7
6
0
It is an ordinary system..
I know all the constants, the variable are z,theta, phi and tau.
 
  • #8
6
0
please could anyone tell me if the system can be solved with the ode45 matlab?
 

Related Threads on Matlab ode45

  • Last Post
Replies
1
Views
3K
  • Last Post
Replies
4
Views
7K
  • Last Post
Replies
0
Views
2K
  • Last Post
Replies
4
Views
6K
Replies
0
Views
3K
Replies
0
Views
5K
  • Last Post
Replies
3
Views
7K
Replies
2
Views
5K
Replies
4
Views
6K
Replies
2
Views
2K
Top