Inf or NaN whilst trying to run a function
1 view (last 30 days)
Show older comments
Hi, I'm very new to MATLAB and I am having some trouble. I'm trying to integrate an equation to solve for specific heat capacity. Could somebody please explain what this error is and how to fix it? Thanks.
T_datum_K = 25+273.15;
T_in_K = 199.3 + 273.15;
T_out_K = 359 + 273.15;
%Ar
C1_Ar = 20786;
C2_Ar = 0;
C3_Ar = 0;
C4_Ar = 0;
C5_Ar = 0;
func = @(T) C1_Ar + C2_Ar.*((C3_Ar./T)./(sinh(C3_Ar./T))).^2 + C4_Ar.*((C5_Ar./T)./(cosh(C5_Ar./T))).^2;
Cp_Ar_in = integral(func, T_datum_K, T_in_K);
Cp_Ar_out = integral(func, T_datum_K, T_out_K);
0 Comments
Answers (1)
VBBV
on 23 May 2023
Edited: VBBV
on 23 May 2023
T_datum_K = 25+273.15;
T_in_K = 199.3 + 273.15;
T_out_K = 359 + 273.15;
%Ar
C1_Ar = 20786;
C2_Ar = 1;
C3_Ar = 0.1;
C4_Ar = 0.1;
C5_Ar = 0.1;
func = @(T) C1_Ar + C2_Ar.*((C3_Ar./T)./(sinh(C3_Ar./T))).^2 + C4_Ar.*((C5_Ar./T)./(cosh(C5_Ar./T))).^2;
Cp_Ar_in = integral(func, T_datum_K, T_in_K)
Cp_Ar_out = integral(func, T_datum_K, T_out_K)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!