plotting T-U diagram using XSteam

조회 수: 5 (최근 30일)
Aidan Palermo
Aidan Palermo 2022년 6월 14일
편집: David Goodmanson 2022년 6월 15일
for n=[1:220]
T=XSteam('Tsat_p',n);
vapor_u=XSteam('uV_T',T);
liquid_u=XSteam('uL_T',T);
end
I'm trying to find temperatures for 1 through 220 but n saves only as 220. How would I get the code to run through all the values?

채택된 답변

David Goodmanson
David Goodmanson 2022년 6월 15일
편집: David Goodmanson 2022년 6월 15일
Hi Aldan,
the code is running through all the values, but it's not saving any of them. You need to do something like
m = 220;
Tsave = zeros(1,m);
vapor_usave = zeros(1,m);
liquid_usave = zeros(1,m);
for n = 1:m
T = XSteam('Tsat_p',n);
Tsave(n) = T;
vapor_usave(n) = XSteam('uV_T',T);
liquid_usave(n) = XSteam('uL_T',T);
end
which results in three 1x220 vectors of values.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by