Cody

Solution 173611

Submitted on 6 Dec 2012 by @bmtran
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
%% % Input: BB Temp, Lo Wavelength, Hi Wavelength, Integration steps % Output radiance in ph/m2/sec/ster % Nominal steps of 1000 yields accuracy and timeliness lo=3.0; hi=5.0; T=250.0; % Radiance = 4.96124998 e18 ph/m2/sec/ster ts=cputime; rad_entry=Calc_Radiance(lo,hi,T) tc=cputime; dt=1000*(tc-ts) % Processing Time in ms rad_correct = 4.96124998e18; % ph/m2/sec/ster tol=.00001; Pass=rad_entry>rad_correct*(1- tol) & rad_entry<rad_correct*(1+ tol) & dt<100; assert(isequal(Pass,1))
rad_entry = 4.9612e+18 dt = 80.0000
2   Pass
%% % Input: BB Temp, Lo Wavelength, Hi Wavelength, Integration steps % Output radiance in ph/m2/sec/ster % Nominal steps of 1000 yields accuracy and timeliness lo=3.0; hi=5.0; T=300.0; % Radiance = 4.1826971 e19 ph/m2/sec/ster ts=cputime; rad_entry=Calc_Radiance(lo,hi,T) tc=cputime; dt=1000*(tc-ts) % Processing Time in ms rad_correct = 4.1826971e19; % ph/m2/sec/ster tol=.00001; Pass=rad_entry>rad_correct*(1- tol) & rad_entry<rad_correct*(1+ tol) & dt<100; assert(isequal(Pass,1))
rad_entry = 4.1827e+19 dt = 10.0000
3   Pass
%% % Input: BB Temp, Lo Wavelength, Hi Wavelength, Integration steps % Output radiance in ph/m2/sec/ster % Nominal steps of 1000 yields accuracy and timeliness lo=8.0; hi=12.0; T=280.0; % Radiance = 1.37122128 e21 ph/m2/sec/ster ts=cputime; rad_entry=Calc_Radiance(lo,hi,T) tc=cputime; dt=1000*(tc-ts) % Processing Time in ms rad_correct = 1.37122128e21; % ph/m2/sec/ster tol=.00001; Pass=rad_entry>rad_correct*(1- tol) & rad_entry<rad_correct*(1+ tol) & dt<100; assert(isequal(Pass,1))
rad_entry = 1.3712e+21 dt = 0
4   Pass
%% % Input: BB Temp, Lo Wavelength, Hi Wavelength, Integration steps % Output radiance in ph/m2/sec/ster % Nominal steps of 1000 yields accuracy and timeliness % Add random to block answer writers lo=3.0+rand hi=5.0+rand T=250.0; % Radiance = To be calculated ph/m2/sec/ster c1p=1.88365e23; % sec^-1cm^-2micron^3 c2=1.43879e4; % micron K steps=1000; x=lo:(hi-lo)/steps:hi; % Planck Vectorized for Trapz y=1e8./(x.^4.*(exp(c2./(x.*T))-1)); % Leading 1e8 is for numerical processing accuracy z=trapz(x,y); rad_correct=z*1e4*c1p/pi()/1e8 % 1e4 normalizes from cm-2 to m-2 ts=cputime; rad_entry=Calc_Radiance(lo,hi,T) tc=cputime; dt=1000*(tc-ts) % Processing Time in ms tol=.00001; Pass=rad_entry>rad_correct*(1- tol) & rad_entry<rad_correct*(1+ tol) & dt<100; assert(isequal(Pass,1))
lo = 3.8763 hi = 5.4886 rad_correct = 1.1397e+19 rad_entry = 1.1397e+19 dt = 0