How to add a label to a general line

1 回表示 (過去 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 Center および File ExchangeLine Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by