BME210 midterm 1 cheat sheet - Copy

BME210 midterm 1 cheat sheet - Copy - Loops: Eulers RK2:...

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

View Full Document Right Arrow Icon
Loops: Euler’s RK2: for k1 (i,:)=h*de(t(i),Run1(i,:),K)'; k2(i,:)=h*de((t(i)+h/2),(Run1(i,:)+k1(i,:)/2),K)'; Run1(i+1,:)=Run1(i,:)+k2(i,:); End; Simpsons: ( 29 ( 29 1 2 3 4 5 3 2 1 ; ( ) 4 ( ) 2 ( ) 4 ( ) 2 ( ) 2 ( ) 4 ( ) ( ) h n n n S f P f x f x f x f x f x f x f x f x - - = + + + + + + + + L e venvectors=conc(2:2:(n-1)); oddvectors=conc(3:2:(n-1)); even=4*evenvectors; odd=2*oddvectors; Simpsons=(h/3)*(conc(1)+sum(even)+sum(odd)+conc(end)); Trapezoidal: ( 29 ( 29 ( 29 ( 29 ( 29 1 1 2 2 ; n h n i i T f P f x f x h f x - = = + + Trapezoidal=(h/2)*(conc(1)+conc(end))+h*((sum(conc)-conc(1)- conc(end))); Rectangular: ( 29 1 1 ( ; ) n i i R f P h f x - = = Rectangular=h*(sum(conc)-conc(end)); Matlab functions: Trapz: trapzfunc=trapz(time,conc); spline: xx=[0:.1:12]; yy=spline(time,conc, xx); plot(time,conc, 'o' , xx, yy, '-' ); ODE45: options =odeset( 'Reltol' , 1e-5, 'AbsTol' ,1e-5); [T1,x11]=ode45( 'dede' ,[0 20],Run1(1,:),options,K); [T2,x22]=ode45( 'dede' ,[0 20],Run2(1,:),options,K); Euler’s: x ( t + h ) = x ( t ) + h f ( x ( t ), t ) RK2: Implicit Euler’s: Function file: Cardiac Output: T 0 D c(t)dt Q= Solving Spline: 1. solve for each x and f(x) 2. Differentiate once equate 2 other and differentiate again and equate to corresponding. 3. Do f(0) and equate 2 corresponding 4. Use boundary conditions for 2 nd deriv. and equate to 0 Assumptions for adding dye dilution: 1. The dye is inert. It remains in the vascular space in its original form. 2. The dye mixes uniformly in the blood. 3. A correction can be made for the recirculated dye. 4. The dye concentration can be measured readily. 5. Cardiac output is constant during the dye dilution procedure. 6. Dye is injected into the vena cava proximal to the right atrium. 7. Blood is sampled as it exits the left ventricle. Derivations for Cardiac Output: V=R*T, D/C=R*T, R=D/C*T, V=Q*T, D=C(t)*V Euler: clc; clear; load( 'dye.dat' ); disp( ' BME 210 HW1 - Cardiac Ouput Calculation' ) disp( ' ' ) D=input( 'Please enter the amount of ICG dye: ' ); %numerical integration x=dye(:,1); y=dye(:,2); n=length(x); %number of data h=x(2)-x(1); %sample interval r_auc=h*(sum(y)-y(n)); %rectangular approximation t_auc=h/2*(y(1)+y(n))+h*(sum(y)-y(1)-y(n)); %Trapezoidal approximation t_auc_2=trapz(x,y); %trapezoidal approximation using built-in function %Simpson's rule s1=y(2:2:n-1); s2=y(3:2:n-2); s_auc=h/3*(y(1)+4*sum(s1)+2*sum(s2)+y(n)); %Calculate cardic output and transfer its value into (L/min) r_co=D/r_auc*60; t_co=D/t_auc*60; t_co_2=D/t_auc_2*60; s_co=D/s_auc*60; disp( ' ' ) disp( 'The area under the dye concentration curve for rectangular,' ) disp( 'traperzoidal, built-in trapezoidal, and Simpson method are: ' ) disp([num2str(r_auc), ' ' ,num2str(t_auc), ' ' ,num2str(t_auc_2), ' ' ,num2str(s_auc), '(mg-sec/L) respectively' ]) disp( ' ' ) disp( 'Cardic Output of rectangular, traperzoidal, built-in trapezoidal, and Simpson method are: ' ) disp([num2str(r_co), ' ' , num2str(t_co), ' '
Background image of page 1

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

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

This note was uploaded on 09/09/2010 for the course BME 210 taught by Professor D'argenio during the Spring '07 term at USC.

Page1 / 2

BME210 midterm 1 cheat sheet - Copy - Loops: Eulers RK2:...

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