Solving Nonlinear Equations of Motion with ODE45 MATLAB

Click For Summary

Discussion Overview

The discussion revolves around solving nonlinear equations of motion using the ode45 function in MATLAB. Participants explore the transformation of second-order differential equations into a system of first-order equations, the necessity of initial conditions, and the formulation of the system for numerical integration.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant inquires about solving nonlinear equations of motion without initial conditions, questioning the feasibility of using ode45 in such a case.
  • Another participant asserts that initial conditions are necessary for using ode45, as it employs numerical integration methods.
  • A participant describes their approach to rewriting a second-order system into first-order equations, detailing the formulation of the function and the role of acceleration terms.
  • There is a suggestion that if the participant knows the state vector y, it may be possible to proceed with the solution.
  • A later reply provides a simplified example of converting a second-order equation into first-order equations, emphasizing the importance of correctly identifying variables in the numerical method.
  • Participants express uncertainty about the correctness of their formulations and seek validation of their approaches.
  • Questions arise regarding the potential need to consider singularities in the system when using ode45.

Areas of Agreement / Disagreement

Participants generally agree that initial conditions are required for solving the system with ode45, but there is uncertainty regarding the specific formulation of the equations and the handling of acceleration terms. The discussion remains unresolved regarding the correctness of the proposed methods and the implications of singularities.

Contextual Notes

Some participants express confusion about the notation and the relationship between different variables in the numerical method. There are also mentions of specific constants and variables that may influence the formulation but are not fully detailed.

jacckko
Messages
6
Reaction score
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

Physics news on Phys.org
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.
 
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
 
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.
 
This is the way I have solved the system. Is it correct?
 

Attachments

Another question.. How can I solve a system like this?
 

Attachments

It is an ordinary system..
I know all the constants, the variable are z,theta, phi and tau.
 
please could anyone tell me if the system can be solved with the ode45 matlab?
 

Similar threads

  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K