Ode45 for solution of 4 d.o.f. problem

  • Thread starter Thread starter bugatti79
  • Start date Start date
  • Tags Tags
    Ode45
Click For Summary

Discussion Overview

The discussion revolves around troubleshooting a code implementation for solving a 4 degree of freedom (dof) problem using the ode45 function in MATLAB. Participants are examining the unexpected output of a straight line response instead of the anticipated oscillatory behavior.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant reports that their code does not produce the expected oscillatory response, instead yielding a straight line that drops off towards the end.
  • Another participant suggests enclosing the source code in code tags to avoid formatting issues and points out that the definition of the time span (tspan) is missing.
  • A participant clarifies that "dof" refers to "degree of freedom" in the context of the system being analyzed.
  • One participant requests the system of equations being solved to better understand the problem.
  • A later reply indicates that the issue was due to an incorrect K matrix, which led to large numbers and a nearly singular matrix, affecting the system's behavior.

Areas of Agreement / Disagreement

Participants express varying levels of understanding regarding the code and the underlying system. There is no consensus on the cause of the issue, as it appears to stem from multiple factors including the K matrix and the definition of the time span.

Contextual Notes

The discussion highlights potential limitations in the provided code, such as missing definitions and the implications of a nearly singular matrix, which may affect the results but remain unresolved.

bugatti79
Messages
786
Reaction score
4
Hi Folks,

I have made up this code in an attempt to find the response time a 4 dof problem. However, I do not get an oscillatory response as I expect, instead I get a straight line which drops off towards the end. Not sure what is happening..any ideas..?

function f = Simple_Planetary(t,y)
f = zeros(8, 1);
f(1) = y(2);
f(2) = -y(7)+2*y(1);
f(3) = y(4);
f(4) = -y(7)+2*y(3);
f(5) = y(6);
f(6) = -y(7)+2*y(5);
f(7) = y(8);
f(8) = 3*y(7)-y(1)-y(2)-y(3)+10*cos(t);

y0 = [1;1;1;1;1;1;1;1];
[t,y] = ode45('Simple_Planetary', tspan, y0);
subplot (211)
plot (t,y (: , 1));
xlabel ('t');
ylabel ('x1 (t)');
subplot (212)

plot (t,y (: , 3));
xlabel ('t');
ylabel ('x2 (t)');

Regards
 
Physics news on Phys.org
Two things that may help are enclosing your source code in code tags. This will eliminate the smiley faces.

The second is it seems this is not the whole program as I can't see what span is defined as.

Lastly, what does d.o.f mean?
 
Hi, sorry I forgot a line for the span. That is all the code...
4 dof is a 4 degree of freedom system, ie for independent variables that we are solving for
Code:
tspan = [0: 0.01: 20];
y0 = [1;1;1;1;1;1;1;1];
[t,y] = ode45('Simple_Planetary', tspan, y0);
subplot (211)
plot (t,y (:, 1));
xlabel ('t');
ylabel ('x1 (t)');
subplot (212)

plot (t,y (:, 3));
xlabel ('t');
ylabel ('x2 (t)');

Code:
function f = Simple_Planetary(t,y)
f = zeros(8, 1);
f(1) = y(2);
f(2) = -y(7)+2*y(1);
f(3) = y(4);
f(4) = -y(7)+2*y(3);
f(5) = y(6);
f(6) = -y(7)+2*y(5);
f(7) = y(8);
f(8) = 3*y(7)-y(1)-y(2)-y(3)+10*cos(t);
 
Could you write down the system of equations you are solving?
 
Hi

Sorry for the delay. It turns out the my K matrix was incorrect from which I derived the system of equations and hence the reason for the large numbers because my matrix was nearly singular etc.
 

Similar threads

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