double loop plot !!

11 Ansichten (letzte 30 Tage)
Karim Ayman
Karim Ayman am 18 Okt. 2015
Kommentiert: Walter Roberson am 12 Jun. 2025
I need do draw a chart showing the change in value (COP) Related to the relation COP=Te/Tc-Te Where Te=-15:10 and Tc=30:50 I want to plot (COP,Te) for each value of Tc Keeping all the plots in one graph Any help !
  1 Kommentar
Walter Roberson
Walter Roberson am 12 Jun. 2025
Te = (-15:10).';
Tc=30:50;
COP = Te ./ Tc - Te;
surf(Tc, Te, COP)

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Aditya
Aditya am 12 Jun. 2025
Hi Karim,
You can use a single for loop to compute COP values for each Tc and plot them together in one graph:
Te = -15:10;
Tc = 30:50;
hold on; % Keep all plots in one graph
for tc = Tc
COP = Te ./ (tc - Te); % Compute COP for the current Tc
plot(Te, COP, 'DisplayName', ['Tc = ' num2str(tc)]); % Plot COP vs Te
end
xlabel('Te');
ylabel('COP');
title('COP vs Te for different Tc values');
legend show;
grid on;
hold off;
I hope this helps!

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by