MATLAB绘制水蒸气温度和压力曲线(IAPWS-IF97公式)
国际水和水蒸气性质协会(The International Association for the Properties of Water and Steam,简称 IAPWS)发布的工业用水和水蒸汽热力性质计算公式 IAPWS-IF97 [IAPWS R7-97(2012)] 在热能动力工程中得到广泛使用。我们用MATLAB实现其调用计算。
温度计算压力和压力计算温度的举例代码如下:
完整代码:https://download.csdn.net/download/corn1949/89939397
%%
clc;close all;clear all;warning off;%清除变量
rand('seed', 100);
randn('seed', 100);
format long g;
addpath(genpath('IAPWS_IF97'));
%% 设置温度和压力范围
press_rng = logspace(-2,0,50)'; % [MPa] 压力 (p) 范围
temp_rng = 273.15+linspace(1,100,50)'; % [K] 温度 (T) 范围
%% (1)根据温度计算水蒸气压力
% 计算
psat = IAPWS_IF97('psat_T',temp_rng); % [MPa] saturation pressure
% 输出数据
outcell={'温度(℃)','压力(MPa(绝压))'};
outcell=[outcell;
num2cell([temp_rng-273.15,psat])]
xlswrite('输出_水蒸汽温度与压力关系.xlsx',outcell);
% 绘图
figure;
plot(temp_rng-273.15,psat,'-r*');
legend({'水蒸气压力'},'Fontname','宋体');
xlabel('T(℃)','fontname','宋体');
ylabel('P(MPa)','fontname','宋体');
title('根据温度计算水蒸气压力','fontname','宋体');
%% (2)根据压力计算水蒸气温度
Tsat = IAPWS_IF97('Tsat_p',press_rng); % [MPa] saturation pressure
figure;
plot(press_rng,Tsat-273.15,'-r*');
legend({'水蒸气温度'},'Fontname','宋体');
xlabel('P(MPa)','fontname','宋体');
ylabel('T(℃)','fontname','宋体');
title('根据压力计算水蒸气温度','fontname','宋体');
% 输出数据
outcell={'压力(MPa(绝压))','温度(℃)'};
outcell=[outcell;
num2cell([press_rng,Tsat-273.15])]
xlswrite('输出_水蒸汽压力与压力关系.xlsx',outcell);
rmpath(genpath('IAPWS_IF97'));
程序结果如下:
outcell =
'温度(℃)' '压力(MPa(绝压))'
[ 1] [0.000657088049117899]
[ 3.0204081632653] [0.000759180031066895]
[ 5.0408163265306] [0.000875062427856518]
[ 7.0612244897959] [ 0.00100630572081242]
[9.08163265306121] [ 0.00115462345455995]
[11.1020408163265] [ 0.00132188155435504]
[13.1224489795918] [ 0.00151010793300661]
[15.1428571428572] [ 0.00172150237436742]
[17.1632653061225] [ 0.00195844667905587]
[19.1836734693878] [ 0.00222351505682837]
[21.2040816326531] [ 0.00251948474885829]
[23.2244897959184] [ 0.00284934686210201]
[25.2448979591837] [ 0.00321631739695146]
[ 27.265306122449] [ 0.00362384844849203]
[29.2857142857143] [ 0.00407563956090893]
[31.3061224489796] [ 0.00457564921391843]
[33.3265306122449] [ 0.00512810641954528]
[35.3469387755102] [ 0.00573752240712575]
[37.3673469387755] [ 0.0064087023740863]
[39.3877551020408] [ 0.00714675727983405]
[41.4081632653061] [ 0.00795711565999032]
[43.4285714285714] [ 0.00884553543820573]
[45.4489795918367] [ 0.009818115712907]
[ 47.469387755102] [ 0.0108813084965421]
[49.4897959183673] [ 0.0120419303852024]
[51.5102040816327] [ 0.0133071741369096]
[ 53.530612244898] [ 0.0146846201373467]
[55.5510204081633] [ 0.0161822477323905]
[57.5714285714286] [ 0.0178084464074557]
[59.5918367346939] [ 0.0195720267943771]
[61.6122448979592] [ 0.0214822314873454]
[63.6326530612245] [ 0.0235487456502435]
[65.6530612244898] [ 0.0257817073986234]
[67.6734693877551] [ 0.0281917179404881]
[69.6938775510204] [ 0.030789851461009]
[71.7142857142857] [ 0.0335876647373025]
[ 73.734693877551] [ 0.036597206470401]
[75.7551020408163] [ 0.0398310263225906]
[77.7755102040816] [ 0.0433021836493221]
[79.7959183673469] [ 0.0470242559159563]
[81.8163265306122] [ 0.0510113467906437]
[83.8367346938775] [ 0.055278093905686]
[85.8571428571429] [ 0.0598396762807523]
[87.8775510204082] [ 0.0647118214023491]
[89.8979591836735] [ 0.0699108119549333]
[91.9183673469388] [ 0.0754534922000491]
[93.9387755102041] [ 0.0813572740008127]
[95.9591836734694] [ 0.0876401424900147]
[97.9795918367347] [ 0.0943206613809919]
[ 100] [ 0.10141797792131]
outcell =
'压力(MPa(绝压))' '温度(℃)'
[ 0.01] [45.8075482070232]
[0.0109854114198756] [47.6579748072513]
[0.0120679264063933] [49.5331019478857]
[0.0132571136559011] [51.4334599742751]
[0.0145634847750124] [53.3595946840189]
[0.0159985871960606] [55.3120678478224]
[0.0175751062485479] [57.2914577484672]
[0.0193069772888325] [59.2983597385596]
[0.0212095088792019] [61.3333868177573]
[0.0232995181051537] [63.3971702301834]
[0.0255954792269954] [65.4903600827822]
[0.0281176869797423] [67.6136259853753]
[0.0308884359647748] [69.7676577132211]
[0.0339322177189533] [71.9531658928963]
[0.0372759372031494] [ 74.170882712345]
[0.0409491506238043] [76.4215626559737]
[0.0449843266896944] [78.7059832656875]
[0.0494171336132383] [81.0249459287924]
[0.0542867543932386] [83.3792766937129]
[0.0596362331659464] [85.7698271144899]
[0.0655128556859551] [88.1974751250548]
[0.0719685673001152] [90.6631259442814]
[ 0.079060432109077] [93.1677130128361]
[0.0868511373751353] [95.7121989628607]
[0.0954095476349994] [98.2975766215152]
[ 0.104811313415469] [100.924870049417]
[ 0.115139539932645] [103.595135614993]
[ 0.12648552168553] [106.309463105743]
[ 0.138949549437314] [109.068976877378]
[ 0.152641796717523] [111.874837041754]
[ 0.167683293681101] [114.728240694445]
[ 0.184206996932672] [117.630423182716]
[ 0.202358964772516] [120.582659414539]
[ 0.222299648252619] [123.586265209152]
[ 0.244205309454865] [126.642598689468]
[ 0.268269579527973] [129.753061716406]
[ 0.294705170255181] [132.919101364939]
[ 0.323745754281764] [136.142211441278]
[ 0.355648030622313] [139.423934040176]
[ 0.390693993705462] [142.765861140821]
[ 0.429193426012878] [146.169636239069]
[ 0.471486636345739] [149.636956013014]
[ 0.517947467923121] [153.169572017886]
[ 0.56898660290183] [156.769292405044]
[ 0.625055192527397] [160.437983658403]
[ 0.6866488450043] [164.177572339778]
[ 0.754312006335462] [167.990046832523]
[ 0.828642772854684] [171.877459070039]
[ 0.910298177991522] [175.841926232558]
[ 1] [179.885632391467]
>>
完整代码:https://download.csdn.net/download/corn1949/89939397