Matlab add-on
이전 댓글 표시
I am currently using the onling version of Matlab which was linked to my college licence number. I am trying to run a thermodynamic but I am having trouble with running the XSteam.m function(functions>XSteam.m)provided by matlab; specfically running one of the functions.
- What are the 'add-on's' that matlab is referring to?
- Does Matlab online have some sort of limit to running the functions?
- Can the 'add-on' be added to the online version?
- Which add-on can be added to the online version on page...https://www.mathworks.com/store/link/products/student/new?
- Doe anybody else have an issue with running the XSteam.m code only in the Matlab ONLINE?

I attached a pdf. copy of all the coding incase anyone would like to try to run the file, I also attached images of the error message I recieved.
답변 (1개)
Walter Roberson
2020년 11월 27일
0 개 추천
The line that shows up in your image as line 3552 is really in line 3550 of XSteam.m . You are using a corrupted version of the file -- one in which at least one function statement has had a matching end statement added to it, so MATLAB thinks that it is dealing with nested functions instead of unnested functions.
In the online version, http://matlab.mathworks.com click on HOME in the upper left corner in order to show the Home toolbar. Move about 2/3 of the way to the right on that toolbar and click on Add-Ons and select Get Add-Ons from there. The Add-On Explorer will show up. Ask it to search for xsteam thermodynamic . A small number of search results will show up. Click on the title bar for X Steam, Thermodynamic properties of water and steam. by Magnus Holmgren . The page specific to that will show up. In the upper right for that page, click to install it, and agree to the license terms. The software will install and will be added to your MATLAB path. In particular, the file will be installed to the directory /MATLAB Add-Ons/Collections/X Steam, Thermodynamic properties of water and steam. ... complete with spaces and period.
If you had somehow copied XSteam to MATLAB Online yourself, then I recommend deleting the copy you uploaded.
댓글 수: 12
Joseph Madrigal
2020년 11월 27일
Walter Roberson
2020년 11월 28일
Sorry, unfortunately I do not understand about "the nt value is based on multiple addition or subtraction values of h based on each individual input P3" and so I do not understand what is being asked for.
Joseph Madrigal
2020년 11월 28일
Walter Roberson
2020년 11월 28일
It looks like XSteam does not like being passed a vector.
Joseph Madrigal
2020년 11월 28일
편집: Joseph Madrigal
2020년 11월 28일
Walter Roberson
2020년 11월 28일
I do not recommend those approaches. I recommend using arrayfun() instead.
v2 = arrayfun(@(p2) XSteam('v_ph', p2, h2), P2);
Joseph Madrigal
2020년 11월 28일
Walter Roberson
2020년 11월 28일
v2 = arrayfun(@(H2) XSteam('v_ph', P2, H2), h2);
Joseph Madrigal
2020년 11월 29일
Walter Roberson
2020년 11월 29일
P3 = [40:5:60]; %[bar]
okay so P3 is a vector.
P2=P3;
so P2 must be a vector as well.
W_p_s=v1*(P2-P1)*1e2; % "SSSF Steady-State Steady-Flow isentropic pump work assuming constant specific volume" ë1e2: bar to kPaí
W_p_s uses P2 and P2 is a vector so W_p_s must be a vector as well.
W_p=W_p_s/Eta_p ;
Eta_p is a scalar, and W_p_s is a vector, so W_p is a vector.
h1= XSteam ('hL_p',P1) ;
I do not know what size XSteam returns, but you would have had problems before the point you are at now if XSteam does not return a scalar.
h2=h1+W_p; % "SSSF First Law for the pump"
W_p is a vector, and h1 is presumed to be a scalar, so h2 is a vector.
v2= XSteam ('v_ph', P2,h2) ;
P2 and h2 are both vectors, and they are the same size of vector. Are you asking to fetch v_ph for each P2 in combination with each h2, or are you asking to fetch values for corresponding pairs of inputs?
%assuming corresponding
v2 = arrayfun(@(thisP2, thish2) XSteam('v_ph', thisP2, thish2), P2, h2);
Walter Roberson
2020년 11월 29일
I had a look at the XSteam code. It would be a lot of rewriting to vectorize it by any way other than internal use of arrayfun.
Joseph Madrigal
2020년 11월 29일
카테고리
도움말 센터 및 File Exchange에서 Mathematics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!