Azzera filtri
Azzera filtri

Why doesn't anything show up on my plot?

1 visualizzazione (ultimi 30 giorni)
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');

Risposta accettata

Star Strider
Star Strider il 23 Apr 2018
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');

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by