Trying to code two angular acceleration equations and angles

2 vues (au cours des 30 derniers jours)
Hendrix
Hendrix le 6 Déc 2012
I wrote
%initial condition of theta angle (precession angle) tt (1) = 0.5;
ttd (1) = 0; ttdd (1) = 0;
el (1) = 0;
eld (1) = (m*g*sin(tt(1)))/(C*omega_s); eldd (1) = 0;
for
ttdd(i+1) =(M_y-((C*omega_s*sin(tt(i)))*((M_x-(C*ttd(i)*omega_s)+(A*eldd(i)*sin(tt(i))))/(((-2)*A*ttd(i)*cos(tt(i)))+(C*ttd(i)*cos(tt(i)))))));
eldd (i+1) = (M_x+ ((2*A*ttd(i)*cos(tt(i)))*((M_y-(A*ttdd(i)))/(C*omega_s*sin(tt(i)))))-(C*ttd(i)*omega_s)-(C*ttd(i)*((M_y-(A*ttdd(i)))/(C*omega_s*sin(tt(i))))*cos(tt(i))));
ttd(i+1) = (ttdd(i+1)*delta_t)+ttd(i);
tt (i+1) = ((ttd(i+1)*delta_t))+tt(i);
eld(i+1) = (eldd(i+1)*delta_t)+eld(i);
el (i+1) = ((eld(i+1)*delta_t))+el(i);
in the Matlab.
end
My inputs are M_x and M_y and trying to get the angles as outputs. All my answers are NAN... Please point out where I got wrong. Thanks
  1 commentaire
Azzi Abdelmalek
Azzi Abdelmalek le 6 Déc 2012
complete your for loop. what is
for
in your program? also, give all data to allow testing your code

Connectez-vous pour commenter.

Réponses (1)

Muthu Annamalai
Muthu Annamalai le 6 Déc 2012
To give you a hint, 1/0 = Inf, 0/0 = NaN. So you need to avoid doing these things in your code.
Special case the situations when you have a potential 0/0 should solve your problem.

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by