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!