How do I plot eta only when it's then 0?
Show older comments
Hi everybody, and thanks for your help.
I need some help for the gollowing code:
- print rendimento only when eta>0
- evalute p02 p2 =((1+((eta.*deltaideal)/(T01*cp))).^(k/(k-1))); when m>0 and with p02=m^2 when m<0
while N<Nmax+1
U1 = (D1*pi.*N)/60;
U2 = (D2*pi.*N)/60;
alfa2b = atan((D1*tan(beta1b))/(sigma*D2));
deltaideal = sigma*(U2^2);
deltahii = 0.5.*((U1-((cot(beta1b).*m)/(ro1*Ai))).^2);
deltahid = 0.5.*(((sigma*D2*U1)/D1)-((m.*cot(alfa2b))/(ro1*Ad))).^2;
deltahfi = kf.*(m.^2);
deltahfd = kfd.*(m.^2);
deltan = deltanbf+deltanv+deltanc+deltand;
deltaloss = deltahii+deltahid+deltahfi+deltahfd;
eta = ((deltaideal)./(deltaideal+deltaloss))-deltan;
p2 =((1+((eta.*deltaideal)/(T01*cp))).^(k/(k-1)));
figure(1);
title('Rendimento')
xlabel('Mass Flow [kg/s]')
ylabel('eta')
grid on
plot(m,eta);
hold on
figure(2);
title('Pressione')
xlabel('Mass Flow [kg/s]')
ylabel('p02')
grid on
plot(m,p2);
hold on
N=N+Nincr
end
1 Comment
prasanth s
on 17 Oct 2019
write the plot function inside the if condition
if eta>0
plot(m,eta);
end
Answers (1)
Paul Rogers
on 17 Oct 2019
2 Comments
Walter Roberson
on 17 Oct 2019
eta is a vector. What does it mean to print rendimento only when eta>0 ? Do you want non-positive values to be skipped in the plot?
Paul Rogers
on 17 Oct 2019
Categories
Find more on Line Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!