Result of this code

1 view (last 30 days)
Hossein G
Hossein G on 6 Jul 2014
Answered: Star Strider on 6 Jul 2014
Hello I've got problem with this part of my code:
for T2=T2ise:50:600
h2-IdealAir(T2,'T','h')-w*(XSteam('hV_T',T2))
end
I want to find different values of this expression but I find
ans=
NaN
ans=NaN
I'd be glad if somebody could help me. result of functions IdealAir & XSteam is in char

Answers (1)

Star Strider
Star Strider on 6 Jul 2014
I’m not quite sure what you’re doing. Perhaps:
h2 = IdealAir(T2,'T','h')-w*(XSteam('hV_T',T2))
might work a bit better (if that’s what you intend).
If T2 is a vector of variables to be used in your functions (as it seems to be), changing your loop to be:
T2=T2ise:50:600;
for k1 = 1:length(T2)
h2(k1) = IdealAir(T2(k1),'T','h')-w*(XSteam('hV_T',T2(k1)));
end
would save the intermediate results of h2 (assuming it is a scalar). Save it as a matrix (adding a dimension) if h2 is a vector with constant lengths over iterations, or as a cell array if its length varies.

Tags

Community Treasure Hunt

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

Start Hunting!