How come I can't plot this?
Mostrar comentarios más antiguos
degree = 140:0.001:220;
thetad = 4;
f = atan(degree*(pi/180));
s = 90-f;
r = 0.1*(degree*(pi/180));
rd = diff(r);
Ar = -r*thetad^2;
Atheta = 2*rd*thetad;
Nc = (0.5*Ar)/cos(s);
Fc = (0.5*Atheta)+Nc*sin(s);
plot(degree,Ar,'black')
plot(degree,Atheta,'blue')
plot(degree,Nc,'yellow')
plot(degree,Fc,'green')
hold on;
grid on;
Respuestas (3)
Image Analyst
el 19 de Nov. de 2018
0 votos
Since diff(s) gives one less element than s, your array dimensions don't match when you try to add Atheta and sin(s).
Star Strider
el 19 de Nov. de 2018
The hold on call should be just after the first plot call, and diff produces a vector (here) that is one element shorter than its argument.
Try this:
degree = 140:0.001:220;
thetad = 4;
f = atan(degree*(pi/180));
s = 90-f;
r = 0.1*(degree*(pi/180));
rd = gradient(r);
Ar = -r*thetad^2;
Atheta = 2*rd*thetad;
Nc = (0.5*Ar)/cos(s);
Fc = (0.5*Atheta)+Nc*sin(s);
plot(degree,Ar,'black')
hold on
plot(degree,Atheta,'blue')
plot(degree,Nc,'yellow')
plot(degree,Fc,'green')
hold off
grid on
madhan ravi
el 19 de Nov. de 2018
In addition to sir Image Analyst's explanation :
degree = 140:0.001:220;
thetad = 4;
f = atan(degree*(pi/180));
s = 90-f;
r = 0.1*(degree*(pi/180));
rd = diff(r);
Ar = -r*thetad^2;
Atheta = 2*rd*thetad;
Nc = (0.5*Ar)./cos(s);
Fc = (0.5.*Atheta)+Nc(1:numel(Atheta)).*sin(s(1:numel(Atheta)));
plot(degree(1:numel(Atheta)),Ar(1:numel(Atheta)),'black')
hold on;
plot(degree(1:numel(Atheta)),Atheta(1:numel(Atheta)),'blue')
plot(degree(1:numel(Atheta)),Nc(1:numel(Atheta)),'yellow')
plot(degree(1:numel(Atheta)),Fc(1:numel(Atheta)),'green')
grid on;
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!