BME210_HW_1_corr

BME210_HW_1_corr - method of rectangular(units of mg-sec/L)...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
% correction load('dyerecirc.dat') x=dyerecirc(:,1);y=dyerecirc(:,2); plot(x,y,'-o') pfit=polyfit(x(6:17),y(6:17),1); pval=polyval(pfit,x(6:end)); logy=log(y); pfit=polyfit(x(6:17),logy(6:17),1); pval=polyval(pfit,x(6:end)); plot(x(6:end),pval) expy=exp(pval); plot(x,[y(1:5);expy]) plot(x,[y(1:5);expy]);hold on;plot(x,y,'-o') y(1:5); expy; % write the data into the file dyecorr.dat % rectangular load('dyecorr.dat') y=dyecorr(:,2); h=dyecorr(2,1)-dyecorr(1,1); totdye=sum(y); n=length(y); totdye=totdye-y(n); area=h*totdye; method1=area; m %trapezoidal approximation method2=(h/2)*(y(1)+y(n))+(totdye-y(1))*h; m %Trapz method3=trapz(y); m % simpson's rule odd=y(3:2:30); even=y(2:2:30); sumodd=sum(odd)*2; sumeven=sum(even)*4; method4=(y(1)+y(31)+sumodd+sumeven)*(h/3); m % Enter the amount of dye input mass_of_dye = input(' Enter the amount of dye input in mg: '); m %Calculate the cardiac output for 4 methods Q1 = mass_of_dye*60/method1; Q2 = mass_of_dye*60/method2; Q3 = mass_of_dye*60/method3; Q4 = mass_of_dye*60/method4; % Output fprintf('The approximation to the area under the dye concentration curve by the
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: method of rectangular(units of mg-sec/L) is %6.3f\n', method1 ) fprintf('The approximation to the area under the dye concentration curve by the method of trapezoidal(units of mg-sec/L) is %6.3f\n', method2 ) fprintf('The approximation to the area under the dye concentration curve by the method of function trapz(units of mg-sec/L) is %6.3f\n', method3 ) fprintf('The approximation to the area under the dye concentration curve by the method of simpson(units of mg-sec/L) is %6.3f\n', method4 ) m fprintf('The cardiac output calculated from the method of rectangular in L/min is %3.3f\n', Q1 ) fprintf('The cardiac output calculated from the method of trapezoidal in L/min is %3.3f\n', Q2 ) fprintf('The cardiac output calculated from the method of function trapz in L/min is %3.3f\n', Q3 ) fprintf('The cardiac output calculated from the method of simpson in L/min is %3.3f\n', Q4 ) %...
View Full Document

This note was uploaded on 09/15/2011 for the course BME 210 at USC.

Page1 / 2

BME210_HW_1_corr - method of rectangular(units of mg-sec/L)...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online