Plotting Lines of Different Colors
Ältere Kommentare anzeigen
I'm plotting the thermal efficiency vs. pressure ratio of an engine based on varying pressure ratio and turbine inlet temperature. I'm coming up with multiple lines of constant temperature on my plot. They're all coming out in blue because of the way I coded it however. If anyone knows how I can change their colors automatically instead of changing my code and going through one by one, that would be awesome.
clear all; close all; clc;
%Defining known values
T3=1100;
nT=0.89;
nC=0.84;
T1=290;
P1=101.325;
k=1.4;
% Overall Efficiency: nth=1-(T1/T3)*((rp)^((k-1)/k))
%%Varying Only Pressure Ratio
rp(1)=0;
i=1;
while rp<=30
nth(i)=1-(T1/T3)*((rp(i)^((k-1)/k)));
i=i+1;
rp(i)=rp(i-1)+0.1;
end
nth(i)=1-(T1/T3)*((rp(i)^((k-1)/k)));
plot(rp,nth);
%%Varying Pressure Ratio and Turbine Inlet Temperature
figure;
T3=800;
while T3<=1500
rp=0;
nth=0;
i=1;
while rp<=30
nth(i)=1-(T1/T3)*((rp(i)^((k-1)/k)));
i=i+1;
rp(i)=rp(i-1)+0.1;
end
nth(i)=1-(T1/T3)*((rp(i)^((k-1)/k)));
plot(rp,nth);
hold on;
T3=T3+100;
end
grid on;
title('Varying Turbine Inlet Temperature');
xlabel('Pressure Ratio, r_p');
ylabel('Thermal Efficiency, \eta_t_h');
legend('800K','900K','1000K','1100K','1200K','1300K','1400K','1500K');
The "Varying Turbine Inlet Temperature" is the plot I am interested in.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!