Solving Nonlinear Equations of Motion with ODE45 MATLAB

In summary, you need to solve the system of first order differential equations using the ode45 MATLAB function.
  • #1
jacckko
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: 426
Physics news on Phys.org
  • #2
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
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
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
This is the way I have solved the system. Is it correct?
 

Attachments

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

Attachments

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

1. What is ODE45 in MATLAB?

ODE45 is a function in MATLAB that is used to numerically solve ordinary differential equations (ODEs) with a variable time step. It is a fourth-order Runge-Kutta method that uses both the fourth and fifth-order equations to estimate the solution, resulting in a higher accuracy compared to other methods.

2. How do I use ODE45 to solve nonlinear equations of motion?

To use ODE45 for solving nonlinear equations of motion, you first need to define your equations of motion as a system of first-order ODEs. Then, you can use the syntax [t,y] = ode45(@odefun, tspan, y0), where odefun is the name of the function that contains your equations of motion, tspan is the time interval, and y0 is the initial conditions. ODE45 will return the solution y at the time points specified by t.

3. What is the difference between linear and nonlinear equations of motion?

Linear equations of motion are those that can be written in the form mx'' + bx' + kx = F(t), where m, b, and k are constants and F(t) is the external force. Nonlinear equations of motion, on the other hand, cannot be expressed in this form and often involve terms with higher powers of x or its derivatives. These equations are more complex and require numerical methods, such as ODE45, to solve.

4. Can ODE45 handle stiff equations of motion?

Yes, ODE45 is designed to handle stiff equations of motion. A stiff equation is one in which the solution changes rapidly over a small time interval. ODE45 uses an adaptive time step to accurately capture these rapid changes in the solution. However, in some cases, you may need to adjust the tolerances or use a different solver to obtain more accurate results.

5. How do I plot the solution obtained from ODE45?

Once you have obtained the solution y from ODE45, you can plot it using the plot function in MATLAB. For example, if you want to plot y versus t, you can use the syntax plot(t,y). You can also customize the plot by adding labels, titles, and changing the color and style of the plot.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
985
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
680
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
3K
  • Introductory Physics Homework Help
Replies
5
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Back
Top