can someone help me with this code? there is something wrong and I don't know what it's.

2 Ansichten (letzte 30 Tage)
%prameters
L = 160
w = 1000 * 2 * pi/60
r = 60
N = 100
th0 = 0
thl = 180
dth = (thl - th0)/N
q=r/L
l = 1
%calculation
for i = 0:1:N
th = (th0 + i * dth) * pi/180;
phi = asin (q * sin(th));
dphidt = w * q * cos(th)/sqrt(1 - (q * sin(th))^2);
vD (i + l) = w * r * sin(phi + th)/cos(phi);
wBD (i + l) = -w * r * cos(th)/(L * cos(phi));
aD (i + l)= w * r * ((cos(phi) * cos(phi + th) * (w + dphidt) - sin(phi) * sin(phi + th) * dphidt)/cos(phi)^2);
alBD (i + l) = -w * q * ((-cos(phi) * sin(th) * w + sin(phi) * cos(th) *dphidt)/cos(phi)^2);
end
figure
plot ((th0:dth:thl) , wBD , (th0:dth:thl) , alBD/100 ,'lineWidth', 2);
xlabel ('\theta ({\circ})') ;
legend ('\omega_{BD} (rad/s)','\alpha_{BD} (10^2 rad/s^2');
axis ([th0 thl - inf inf]);
figure
plot ( [th0:dth:thl] , vD/10 , [th0:dth:thl] , aD/1000 , 'LineWidth' , 2 );
xlabel ('\theta ({\circ})');
legend ('v_D (10^1 in/s)','a_D (10^3 in/s^2)');
axis ([tho thl - inf inf]);
N = 100
thl = 180
N = 100
clc

Antworten (1)

KALYAN ACHARJYA
KALYAN ACHARJYA am 21 Nov. 2021
Bearbeitet: KALYAN ACHARJYA am 21 Nov. 2021
Replace all lines
axis ([th0 thl -inf inf]);
More
figure
plot (th0:dth:thl, wBD , th0:dth:thl , alBD/100 ,'lineWidth', 2);
xlabel ('\theta ({\circ})') ;
legend ('\omega_{BD} (rad/s)','\alpha_{BD} (10^2 rad/s^2');
axis ([th0 thl -inf inf]);
figure
plot (th0:dth:thl, vD/10 , th0:dth:thl , aD/1000 , 'LineWidth' , 2 );
xlabel ('\theta ({\circ})');
legend ('v_D (10^1 in/s)','a_D (10^3 in/s^2)');
axis ([th0 thl -inf inf]);
  2 Kommentare
KALYAN ACHARJYA
KALYAN ACHARJYA am 21 Nov. 2021
Bearbeitet: KALYAN ACHARJYA am 21 Nov. 2021
%prameters
L = 160;
w = 1000 * 2 * pi/60;
r = 60;
N = 100;
th0 = 0;
thl = 180;
dth = (thl - th0)/N;
q=r/L;
l = 1;
%calculation
for i = 0:1:N
th = (th0 + i * dth) * pi/180;
phi = asin (q * sin(th));
dphidt = w * q * cos(th)/sqrt(1 - (q * sin(th))^2);
vD (i + l) = w * r * sin(phi + th)/cos(phi);
wBD (i + l) = -w * r * cos(th)/(L * cos(phi));
aD (i + l)= w * r * ((cos(phi) * cos(phi + th) * (w + dphidt) - sin(phi) * sin(phi + th) * dphidt)/cos(phi)^2);
alBD (i + l) = -w * q * ((-cos(phi) * sin(th) * w + sin(phi) * cos(th) *dphidt)/cos(phi)^2);
end
figure
plot (th0:dth:thl, wBD , th0:dth:thl , alBD/100 ,'lineWidth', 2);
xlabel ('\theta ({\circ})') ;
legend ('\omega_{BD} (rad/s)','\alpha_{BD} (10^2 rad/s^2');
axis ([th0 thl -inf inf]);
figure
plot (th0:dth:thl, vD/10 , th0:dth:thl , aD/1000 , 'LineWidth' , 2 );
xlabel ('\theta ({\circ})');
legend ('v_D (10^1 in/s)','a_D (10^3 in/s^2)');
axis ([th0 thl -inf inf]);
It's working, please do the memory allocation in arrays.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by