Why doesn't anything show up on my plot?

1 次查看(过去 30 天)
clear all;
clc;
Fi=1000;
Se= 50;
Su= 450;
C= 2/3;
nf=[];
for D=2:01:6;
A= 0.25*pi*(D)^2;
siga= ((C*3662.5+Fi)-(C*1000+1000))/2*A;
sigm= ((C*3662.5+Fi)+(C*1000+1000))/2*A;
sigi= sigm-siga;
nf= (Se*(Su-sigi))/(siga*(Su+Se));
end
figure(1)
D=2:6
plot(D,nf)
xlabel('D');
ylabel('nf');

采纳的回答

Star Strider
Star Strider 2018-4-23
Define ‘D’ before the loop, and subscript ‘nf’ in the loop:
Fi=1000;
Se= 50;
Su= 450;
C= 2/3;
nf=[];
D=2:01:6;
for k = 1:numel(D)
A= 0.25*pi*(D(k))^2;
siga= ((C*3662.5+Fi)-(C*1000+1000))/2*A;
sigm= ((C*3662.5+Fi)+(C*1000+1000))/2*A;
sigi= sigm-siga;
nf(k)= (Se*(Su-sigi))/(siga*(Su+Se));
end
figure(1)
plot(D,nf)
xlabel('D');
ylabel('nf');

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Axis Labels 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by