Use XSteam with vectors

조회 수: 6 (최근 30일)
Guglielmo Giambartolomei
Guglielmo Giambartolomei 2022년 5월 13일
댓글: Guglielmo Giambartolomei 2022년 5월 17일
Hello,
I have to modify some pressure values with XSteam but I realized this code use only scalars. Example: XSteam(‘rho_pT’,1,200) returns the density at 1 bar and 200°C. Instead of the values ​​1 and 200 I would like to put a vector of pressure and a vector of temperatures.
How could I do that?
Thank you,
have a nice day,
Guglielmo

채택된 답변

dpb
dpb 2022년 5월 13일
You'd have to rewrite the interface for XSteam itself to know what to do with vector inputs; I've looked at that code some in the past and while doable, it would be quite a bit of work given all the functions there are.
It would end up being a (probably recursive) loop to do the multiple cases inside anyway, so probably the way to approach it if you want a higher-level interface that is vectorized is to just write a wrapper routine that takes the input and contains the looping construct to call the calculational routine for the combination of inputs.
  댓글 수: 1
Guglielmo Giambartolomei
Guglielmo Giambartolomei 2022년 5월 17일
Hello dpb,
I solved with a simple "for" cycle.
Thank you,
Guglielmo

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by