I am writing a program to find 7 degrees of freedom, but I keep getting an error message that "the argument 'x' is undefined". Could somebody please tell me what I am doing wrong?(adsbygoogle = window.adsbygoogle || []).push({});

function dx = IMatrix(t,x,lamda,E)

I1 = 4250;

I2 = 5175;

I3 = 8397;

lamda(1) = 2/(38^.5);

lamda(2) = 5/(38^.5);

lamda(3) = 3/(38^.5);

theta = 15*(pi/180);

E(1) = lamda(1)*sin(theta/2);

E(2) = lamda(2)*sin(theta/2);

E(3) = lamda(3)*sin(theta/2);

E(4) = cos(theta/2);

x0 = [E(1) E(2) E(3) E(4) 0.2 0.7 0.4];

% Derivatives of Euler parameters represented as dx1 - dx4

dx = zeros(7,1);

dx(1) = 0.5*(x(7)*x(2) - x(6)*x(3) + x(5)*x(4));

dx(2) = 0.5*(-x(7)*x(1) + x(5)*x(3) + x(6)*x(4));

dx(3) = 0.5*(x(6)*x(1) - x(5)*x(2) + x(7)*x(4));

dx(4) = 0.5*(-x(5)*x(1) - x(6)*x(2) - x(7)*x(3));

% Derivatives of Euler Equations (w) are replaced with values dx5-dx7

dx(5) = -x(6)*x(7)*(I3-I2)/I1;

dx(6) = -x(7)*x(5)*(I1-I3)/I2;

dx(7) = -x(5)*x(6)*(I2-I1)/I3;

options = odeset('RelTol',1e-8);

[T,X] = ode45(@IMatrix,[0 60],x0,options);

fprintf('---------------------------------------------------')

fprintf('w1 w2 w3 E1 E2 E3 E4 ')

fprintf('---------------------------------------------------')

fprintf(x(1) x(2) x(3) x(4) x(5) x(6) x(7))

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Ode45 help in MATLAB

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

Loading...

Similar Threads for Ode45 help MATLAB |
---|

Help with Excel graph please |

MATLAB MATLAB: forces acting on an object |

MATLAB MATLab: Not enough inputs for nlinfit |

MATLAB Help needed to fix a matlab code |

LaTeX Help with page dimensions in latex |

**Physics Forums | Science Articles, Homework Help, Discussion**