clear all; close all; clc
%conversion constant Celsius-Kelvin
c=273.16;
%load PianoTSacqua.mat non necessario->ho direttamente il grafico
T1= py.CoolProp.CoolProp.PropsSI('T','P',101325,'Q',0,'Water')
T_min=0+c;
T_max=600+c;
T = linspace(T_min,T_max,50000);
P = [0.01 0.1 1 5 30 100 250 500 1000]*10^5;
fh = figure;
for i=1:length (P)
for j=1:length (T)
S(i,j)= py.CoolProp.CoolProp.PropsSI('S','P',P(i),'T',T(j),'Water');
if S(i,j)<0
S(i,j)=NaN;
else
S(i,j)=S(i,j);
end
end
end
curve limite-saturazione costruzione diagramma Entropico
T_crit = py.CoolProp.CoolProp.PropsSI('Tcrit','Water')
P_crit = py.CoolProp.CoolProp.PropsSI('Pcrit','Water')
for j=1:length (T)
if T(j)>=T_min && T(j)<=T_crit;
T_sat(j)=T(j);
sliq(j)= py.CoolProp.CoolProp.PropsSI('S','T',T_sat(j),'Q',0,'Water');
svap(j)= py.CoolProp.CoolProp.PropsSI('S','T',T_sat(j),'Q',1,'Water');
else
T_sat(j)=NaN;
sliq(j)= NaN;
svap(j)= NaN;
end
end
figure(1)
hold on
plot (S,T,'--', 'Color',[17 17 17]/255)
ylim([0 T_max])
xlabel('Entropia (J/(kgK)')
ylabel('Temperatura (K)')
for i=1:length(P)
text(S(i,end), T(end), sprintf('%1.1f MPa', P(i)/10^6, 'Rotation',90))
end
plot(svap,T_sat, 'r-')
plot(sliq,T_sat, 'b-')
ylim([0 873])
save

 Respuesta aceptada

Les Beckham
Les Beckham el 17 de Abr. de 2023
P = [1 2]*10^7; % made up data to test with
S = [1 2;
2 3];
T = [0 70;
0 100];
plot(S(1,:),T(1,:), S(2,:), T(2,:))
grid on
ylim([0 130])
xlim([0 4])
for i=1:length(P)
% text(S(i,end), T(end), sprintf('%1.1f MPa', P(i)/10^6, 'Rotation',90))
% ^ ^
% move the paren at the end to here ^---------------| paren to here
text(S(i,end), T(i,end), sprintf('%1.1f MPa', P(i)/10^6), 'Rotation',90)
% ^ also index T
end

3 comentarios

locatelli vinicio
locatelli vinicio el 18 de Abr. de 2023
Perfect thanks was the parenthesis to move
Grazie mille ciao
Vinicio
Les Beckham
Les Beckham el 19 de Abr. de 2023
You are quite welcome (prego)
Les Beckham
Les Beckham el 19 de Abr. de 2023
If your problem is solved, would you please "Accept this answer". Thanks.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Preguntada:

el 17 de Abr. de 2023

Comentada:

el 19 de Abr. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by