How to add a label to a general line

조회 수: 4 (최근 30일)
alireza rahimi
alireza rahimi 2020년 5월 28일
답변: alireza rahimi 2020년 5월 28일
clear all;
close all;
clc;
r = 0:.1:14; % (valume of compration ratio)
b = input ( 'input number of specific heat ratio (k) ');
for i=1:b
if i <=b
k = input ( 'impot volume of specific heat ratio1 : ');
f = 1 - ( 1./ r.^(k-1));
figure(1);
title 'comparison';
ylabel('efficiency')
plot (r,f)
ax = gca;
ax.FontSize = 13;
hold on ;
legend('otto')
ylim([0 1])
i = i+1;
figure(2)
title 'otto cycle';
xlabel('r')
ylabel(' ? ')
plot(r,f)
hold on;
ylim([0 1])
end
end
r = 0:.1:26; % (valume of compration ratio)
v = input ( 'input number of cut off : ');
for i=1:v
if i <=v
rc = input ( 'impot volume of cut off : ');
k = 1.4;
f1 = 1 - (( 1 ./ (r.^(k-1))) * (((rc.^k)-1) / (k.*(rc-1))));
figure(1);
title 'comparison';
ylabel('efficiency')
plot (r,f1,'--')
ax = gca;
ax.FontSize = 13;
hold on ;
legend('Otto','Diesel')
ylim([0 1])
i = i+1;
figure(3)
xlabel('r')
ylabel(' ? ')
title 'Diesel cycle';
plot(r,f1);
ylim([0 1])
hold on
end
end
r = 0:.1:30; % (valume of compration ratio)
l= input ( 'input number of specific heat ratio (k) ');
for i=1:l
if i <=l
k = input ( 'impot volume of specific heat ratio : ');
f2 = 1 - (1./r.^((k-1)./k)) ;
figure(1);
title 'comparison';
ylabel('efficiency')
plot (r,f2,'b--o')
ax = gca;
ax.FontSize = 13;
hold on ;
legend('Otto','Diesel','Brayton')
ylim([0 1])
i = i+1;
figure(4)
title ' Brayton cycle ';
plot(r,f2);
ylim([0 1])
hold on
end
end
I designed 3 cycles Brighton, Diesel, Otto
And l used 3 loops in order of names and 4 shapes were drawn.
Comparison
Brighton cycle
Diesel cycle
Otto cycle
And I don't know how I can show the amount of( K) taken from the user in the cycle Otto
(rc) in the diesel cycle and( k) in the shape of Brighton.

답변 (2개)

madhan ravi
madhan ravi 2020년 5월 28일
Use sprintf(...)

alireza rahimi
alireza rahimi 2020년 5월 28일
what exacly use for ? it dose for leble or not :(

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by