FILE-7746 (1)

pdf

School

University of Southern California *

*We aren’t endorsed by this school

Course

210

Subject

Mechanical Engineering

Date

Apr 3, 2024

Type

pdf

Pages

10

Uploaded by BarristerMorning10880

Report
1 BME 210 Spring 2011 Name: Solutions _______ EXAMINATION #1 (1 hour, 15 minutes) 1. (20 points) A dye-dilution procedure was performed in a patient in which 0.02 grams of dye were injected into the superior vena cava and the dye concentrations (C(t)) given in the table below were measured in the aorta at several times. t – time (sec) C(t) – dye concentration (mg/L) 5 0 10 0 15 0 20 0 25 30 30 10 35 4 40 1 Using these data, estimate the area under the dye concentration-time curve by (a) trapezoidal approximation, and (b) Simpson’s method. Include the units for your result. In each case, use the area under the curve to calculate the cardiac output for this patient, given in liters per minute. a) Trapezoidal approximation T ( f ; P ) = h 2 ( f ( x 1 ) + f ( x n )) + h f ( x i ) i = 2 n 1 T ( f ; p ) = 5 2 (0 + 1) + 5 (0 + 0 + 0 + 30 + 10 + 4) = 222.5 mg sec L ˙ Q D T ( f ; P ) = 20 mg 222.5 mg sec L = .08988 L sec 60 sec min = 5.39 L min
2 b) Simpson’s method We have an even number of points, so we have to use trapezoidal integrations for the first or last point. Using trapezoidal integration for the first point gives: S ( f ; P ) = h 3 ( f ( x 2 ) + 4 f ( x 3 ) + 2 f ( x 4 ) + 4 f ( x 5 ) + 2 f ( x 6 ) + 4 f ( x 7 ) + f ( x 8 )) + h 2 ( f ( x 1 ) + f ( x 2 )) S ( f ; p ) = 5 3 (0 + 4 0 + 2 0 + 4 30 + 2 10 + 4 4 + 1) + 5 2 (0 + 0) = 261.67 mg sec L ˙ Q D S ( f ; P ) = 20 mg 261.67 mg sec L = .0764 L sec 60 sec min = 4.59 L min Alternatively, using trapezoidal approximation for the last point: S ( f ; p ) = h 3 ( f ( x 1 ) + 4 f ( x 2 ) + 2 f ( x 3 ) + 4 f ( x 4 ) + 2 f ( x 5 ) + 4 f ( x 6 ) + f ( x 7 )) + h 2 ( f ( x 7 ) + f ( x 8 )) S ( f ; p ) = 5 3 (0 + 4 0 + 2 0 + 4 0 + 2 30 + 4 10 + 4) + 5 2 (4 + 1) = 185.83 mg sec L ˙ Q D S ( f ; P ) = 20 mg 185.83 mg sec L = 0.108 L sec 60 sec min = 6.46 L min For this example, the first solution gives a better approximation.
3 2. (10 points) The curve shown below was recorded following a dye dilution experiment performed to measure blood flow through the pancreas. Flow is assumed to be constant (F=0.1 L/min) during the experiment (from 0 to 10min). If total dye injected at time 0 is 20mg (D=20 mg) find C0. F = D C ( t ) dt 0 10 C ( t ) dt 0 10 = C ( t ) dt + C ( t ) dt 4 10 2 4 = (4 2) C 0 + (10 4) C 0 2 = 5 C 0 F = D 5 C 0 C 0 = D 5 F = 20 mg 5min 0.1 L min = 40 mg L
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
4 3. (15 points) The following program computes cardiac output from dye dilution data. To do so, it performs a numerical integration of dye concentration vector y by rectangular approximation and Simpson’s method. The definitions of M, s1, and s2 needed in the final AUC equations (indicated in the circles) have been deleted from the program. What do M, s1, and s2 have to be so that the program will function correctly? Write in your answer in the rectangles below. You may use more than one line if you need to, but you may NOT use any loops . % Program to calculate Cardiac Output using dye dilution data clc; clear; data=importdata( 'dye.dat' ); D=input( 'Please enter the amount of ICG dye: ' ); %Numerical integration x=data(:,1); y=data(:,2); %time and dye vectors from data file n=length(x); %number of data points h=x(2)-x(1); %sample interval %Rectangular approximation M =sum(y(1:n-1) ; r_auc= h* M ; %AUC from rectangular approximation %Simpson's method 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)); %AUC from Simpson’s method %Calculate cardiac output and transfer its value into (L/min) r_co=D/r_auc*60; s_co=D/s_auc*60; disp( 'The area under the dye concentration curve for' ) disp( 'Rectangular and Simpson method are: ' ) disp([ num2str(r_auc), ' ' ,num2str(s_auc), '(mg-sec/L) respectively' ]) disp( ' ' ) disp( 'Cardic Output of rectangular and Simpson method are: ' ) disp([num2str(r_co), ' ' , num2str(s_co), ' (L/min) respectively' ]);
5 4. (10 points) A receptor-ligand kinetic diagram is given below. Write a system of first order differential equations for the model assuming the interactions can be described using mass action and the rate processes are first order. dL ( t ) dt = k 1 L ( t ) R ( t ) + k 2 LR 1( t ) L (0) dR ( t ) dt = k 1 L ( t ) R ( t ) + k 2 LR 1( t ) R (0) dLR 1( t ) dt = k 1 L ( t ) R ( t ) + k 4 LR 2( t ) ( k 2 + k 3) LR 1( t ) LR 1(0) dLR 2( t ) dt = k 3 LR 1( t ) + k 6 LR 3( t ) ( k 4 + k 5 + k 7) LR 2( t ) LR 2(0) dLR 3( t ) dt = k 5 LR 2( t ) ( k 6 + k 8) LR 3( t ) LR 3(0) dLR 4( t ) dt = k 7 LR 2( t ) LR 4(0) dLR 5( t ) dt = k 8 LR 3( t ) LR 5(0)
6 5. (15 points) Use the Runge-Kutta method of order 2 to approximate the solution to the following two differential equations: Use an integration step size of 0.2 and perform a single step . Show the values you calculated for x 1 ( t = 0.2) and x 2 ( t = 0.2). Show all intermediate steps of your work, including the equations used in your calculations RK2 algorithm for the above 2 equations: k 1 1 = h f 1 ( x 1 ( t ), x 2 ( t ), t ) = h ⋅ − tx 1 ( t ) k 1 2 = h f 2 ( x 1 ( t ), x 2 ( t ), t ) = h ( x 1 ( t ) + x 2 ( t )) k 2 1 = h f 1 ( x 1 ( t ) + k 1 1 2 , x 2 ( t ) + k 1 2 2 , t + h 2 ) = h ⋅ − ( t + h 2 )( x 1 ( t ) + k 1 1 2 ) k 2 2 = h f 2 ( x 1 ( t ) + k 1 1 2 , x 2 ( t ) + k 1 2 2 , t + h 2 ) = h (( x 1 ( t ) + k 1 1 2 ) + ( x 2 ( t ) + k 1 2 2 )) x 1 ( t + h ) = x 1 ( t ) + k 2 1 x 2 ( t + h ) = x 2 ( t ) + k 2 2 Plugging in the numbers and performing one step: t = 0; x 1 ( t ) = x 1 (0) = 5; x 2 ( t ) = x 2 (0) = 0; h = 0.2 k 1 1 = h ⋅ − tx 1 ( t ) = 0.2 0 5 = 0 k 1 2 = h ( x 1 ( t ) + x 2 ( t )) = 0.2 (5 + 0) = 1 k 2 1 = h ⋅ − ( t + h 2 )( x 1 ( t ) + k 1 1 2 ) = 0.2 (0 + 0.2 2 )(5 + 0 2 ) = 0.1 k 2 2 = h (( x 1 ( t ) + k 1 1 2 ) + ( x 2 ( t ) + k 1 2 2 )) = 0.2 ((5 + 0 2 ) + (0 + 1 2 )) = 1.1 x 1 (0.2) = x 1 ( t ) + k 2 1 = 5 0.1 = 4.9 x 2 (0.2) = x 2 ( t ) + k 2 2 = 0 + 1.1 = 1.1
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
7 6. (20 points total) a) (5 points) The MATLAB program shown below implements ODE45 to solve the following differential equation and initial condition: dx dt = 10 x cos5 t x (0) = 5 The solution found by the program is shown at the bottom of the page. Does the program produce the correct solution to the equation above ? YES NO (circle the correct answer) function iflag_main=EXAM1_1 % EXAM1_1.m % An M-file implementing ODE45 to solve the diff. eq. % dx/dt = -10.0*cos(5.0*t)*x; x(0)=5. % trange = [0 3]; % time interval x0=5.0; % initial condition [t,x]=ode45(@FUN,trange,x0); plot(t,x, 'ro' );xlabel( 't' ); ylabel( 'x' ); return ; function dxdt=FUN(t,x) % Function containing the diff. eq. dxdt=-10.0*cos(5*t)*x; return ; ___________________________ >> EXAM1_1
8 b) (10 points) The following MATLAB program implements RK2 to solve the differential equation given in the function FUN. The output plot is shown below, and is incorrect . This program contains two mistakes . Find the two mistakes . Cross out any lines of code that are wrong (if applicable) and write in new lines of code so the program produces the correct solution to the equation in FUN. function iflag_main=EXAM1_2 % EXAM1_2.m % An M-file implementing the RK2 method % to solve a differential equation % % Algorithm set-up h=0.1; % step size tinit=0.0; % initial time tfinal=3.0; % final time x(1)=5.0; % initial condition n=((tfinal-tinit)/h) + 1; % calculate number of time points t = linspace(tinit,tfinal,n); % set-up vector of solution times % % Perform recursive steps of RK2 propagation formula for i=1:n-1 K1=h*FUN(t(i),x(i)); K2=h*FUN(t(i)+h/2,x(i)+K1); K2=h*FUN(t(i)+h/2,x(i)+K1/2); x(i+1)=x(i)+K1 ; x(i+1)=x(i)+K2; end % plot(t,x, 'ro' ); xlabel( 't' ); ylabel( 'x' ); return ; function dxdt=FUN(t,x) % Function containing the diff. eq. dxdt=-5*x; return ; ___________________________ >> EXAM1_2
9 c) (5 points) The following MATLAB program implements Euler’s method to solve the differential equation given in the function FUN. An attempt to run the program produces the error messages shown at the end. The program contains one mistake . Find the mistake . Cross out any lines of code that are wrong (if applicable) and write in new lines so the program produces the correct solution to the equation in FUN. function iflag_main=EXAM1_3 %EXAM1_3.m % An M-file implementing Euler's method to solve the diff. eq. % dx/dt = -10.0*cos(5.0*t)*x; x(0)=5. % % Algorithm set-up h=0.1; % step size tinit=0.0; % initial time tfinal=4.0; % final time n = (tfinal-tinit)/h + 1; % calculate number of time points t = linspace(tinit,tfinal,n); % set-up vector of solution times x(1) = 5; % initial condition % Perform recursive steps of Euler’s method for i=1:n-1 x(i+1)=x(i)+h*FUN(x(i),t(i)); end plot(t,x, 'ro' ) return ; function dxdt=FUN(x,t) % Function containing the diff. eq. dxdt = -10.0*cos(5.0*t)*x; return ; _________________________________________ >> EXAM1_3 ??? Undefined function or variable "x". Error in ==> EXAM1_3 at 16 x(i+1)=x(i)+h*FUN(x(i),t(i));
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
10 7. (10 points) Write a MATLAB program that solves the system of differential equations below using MATLAB’s built-in differential equations solver ODE45 on the interval 0 to 5. Your answer should include a complete main program m-file that calls the ODE45 function (relat ive and absolute tolerances set to 1.0e - 5) . Your answer must also include the complete function m-file that contains the differential equations required by MATLAB’s ODE45 function. The program should produce a single plot of L vs. t. dL ( t ) dt = k 1 t L ( t ) R ( t ) + k 2 RL ( t ) L (0) = 12 dR ( t ) dt = k 1 L ( t ) R ( t ) + k 2 RL ( t ) R (0) = 8 dRL ( t ) dt = k 1 L ( t ) R ( t ) ( k 2 + k 3) t RL ( t ) RL (0) = 0 k 1 = 10 k 2 = 20 k 3 = 30 Be sure to use proper MATLAB syntax in writing your code; it should be able to run in MATLAB as written. % prob7.m - solution to Exam1 problem7 % clc; clear; % Initial conditions x0 = [12 8 0]; % use built-in ode45 to solve equations trange=[0 5]; options=odeset( 'Reltol' ,1e-5, 'Abstol' ,1e-5); [t,x] = ode45( 'prob7de' ,trange,x0,options); plot(t,x(:,1)); xlabel( 't' ); ylabel( 'L' ) % prob7de.m % Differential equations for Exam 1 problem 7 % function dxdt =prob7de(t,x) k1 = 10; k2 = 20; k3 = 30; dxdt = [-k1*t*x(1)*x(2) + k2*x(3); -k1*x(1)*x(2) + k2*x(3); k1*x(1)*x(2) - (k2+k3)*t*x(3)]; return