Problem14_7 - fprintf('\n0= %8.6f + %8.7fT + %9.8fT^2 +...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function Problem14_7(T,o1,o2,o3,ti,oi,ci) %Problem 14.7 % %T=temperature in degrees Celsius %ci=given concentration along with ti=given temp, from these values, calc %dissolved oxygen and percent error. True value of dissolved oxygen is %passed into funciton by oi. % TT=[T;T;T]; e=[zeros(7,1); linspace(10,10,7)'; linspace(20,20,7)']; d=size(TT); Z=[ones(d) TT TT.^2 TT.^3 e]; oxg=[o1;o2;o3]; a=Z\oxg;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: fprintf('\n0= %8.6f + %8.7fT + %9.8fT^2 + %11.10fT^3 + %9.8fc\n\n',a(1),a(2),a(3),a(4),a(5)); y2=a(1)+a(2)*ti+a(3)*ti^2+a(4)*ti^3+a(5)*ci; fprintf('\nAt T=%2d and c=%2d, the predicted value of o is %9.8f which is much closer to the true\nvalue of %3.2f than in the previous problem\n\n',ti,ci,y2,oi); a0=a(1); a1=a(2); a2=a(3); a3=a(4); a4=a(5); ofit=a0+a1.*TT+a2.*TT.^2+a3.*TT.^3+a4.*e; %linear regression plot(oxg,ofit,'o',oxg2,y3);...
View Full Document

Ask a homework question - tutors are online