How come I can't plot this?
이전 댓글 표시
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;
답변 (3개)
Image Analyst
2018년 11월 19일
0 개 추천
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
2018년 11월 19일
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
2018년 11월 19일
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;
카테고리
도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!