Cody

Problem 46726. [Thermodynamics] Polynomial fitting of heat capacity data

Solution 3179041

Submitted on 12 Oct 2020 by Rafael S.T. Vieira
  • Size: 19
  • This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
T = 300:100:1000; % hydrogen @ 300K < T < 1000K CP = [28.85 29.18 29.26 29.32 29.44 29.62 29.88 30.2]; cpfun = cpFitting(T,CP,2); assert(abs(cpfun(350)-29.0074) < 1e-3 && abs(cpfun(550)-29.2505) < 1e-3 && abs(cpfun(940)-29.9943) < 1e-3);

2   Pass
T = 500:100:1500; % water/steam @ 500K < T < 1500K CP = [35.22 36.22 37.5 38.74 40 41.27 42.52 43.75 44.94 46.06 47.11]; cpfun = cpFitting(T,CP,3); assert(abs(cpfun(560)-35.842) < 1e-3 && abs(cpfun(1000)-41.26) < 1e-3 && abs(cpfun(1400)-46.0668) < 1e-3);

3   Pass
T = 100:100:1000; % methane @ 100K < T < 1000K CP = [33.28 33.51 35.76 40.63 46.63 52.74 58.6 64.08 69.14 73.75]; cpfun = cpFitting(T,CP,3); assert(abs(cpfun(290)-35.993) < 1e-3 && abs(cpfun(630)-54.1682) < 1e-3 && abs(cpfun(950)-71.6749) < 1e-3);

4   Pass
str = fileread('cpFitting.m'); % sorry, no regexp hacks :-) assert(isempty(regexp(str,'regexp')));

Suggested Problems

More from this Author4

Community Treasure Hunt

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

Start Hunting!