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);
P =
0.0000 0.0002 28.8077
cpfun =
function_handle with value:
@(t)sum(fliplr(P).*t.^(0:N))
|
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);
P =
-0.0000 0.0000 0.0041 31.2662
cpfun =
function_handle with value:
@(t)sum(fliplr(P).*t.^(0:N))
|
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);
P =
-0.0000 0.0002 -0.0346 35.0203
cpfun =
function_handle with value:
@(t)sum(fliplr(P).*t.^(0:N))
|
4 | Pass |
str = fileread('cpFitting.m'); % sorry, no regexp hacks :-)
assert(isempty(regexp(str,'regexp')));
|
584 Solvers
531 Solvers
Implement a bubble sort technique and output the number of swaps required
153 Solvers
07 - Common functions and indexing 3
317 Solvers
2048 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!