Why are values not rotated?

1 view (last 30 days)
locatelli vinicio
locatelli vinicio on 17 Apr 2023
Commented: Les Beckham on 19 Apr 2023
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

Answers (1)

Les Beckham
Les Beckham on 17 Apr 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 Comments
Les Beckham
Les Beckham on 19 Apr 2023
You are quite welcome (prego)
Les Beckham
Les Beckham on 19 Apr 2023
If your problem is solved, would you please "Accept this answer". Thanks.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!