Thread Closed

ode45 help in MATLAB

 
Share Thread Thread Tools
Nov19-09, 05:48 PM   #1
 

ode45 help in MATLAB


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?

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))
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> King Richard III found in 'untidy lozenge-shaped grave'
>> Google Drive sports new view and scan enhancements
>> Researcher admits mistakes in stem cell study
Thread Closed

Tags
computers, integration, matlab, ode45, programming
Thread Tools


Similar Threads for: ode45 help in MATLAB
Thread Forum Replies
solving four ordinary dif equations simultaneously using ode45 matlab Math & Science Software 12
need help for ODE45 matlab Math & Science Software 3
Matlab Help:Stop ode45 with OutpuFcn Math & Science Software 0
How to follow a function's value in ODE45 Matlab? Math & Science Software 5
MatLab help using ode23/ode45 Math & Science Software 2