BME210_Sp2024_HW1_Soltns_V2

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

8

Report

Uploaded by BrigadierGull4139

Spring 2024 BME 210 Homework 1: Measuring Cardiac Output Solutions
Part 1: Report Summary (15 points) Problem Definition Cardiac output, the volume of blood pumped by the heart in a given period of time (usually one minute), is one of the most important variables for assessing the cardiovascular system, though it is very hard to measure in the intact human cardio-vascular system. This project uses dye dilution data to calculate cardiac output via several computational methods for calculating the area under the dye dilution curve. Recirculation-correction has already been performed on the concentration-time data provided, but would be necessary if one were given only raw concentration data. Spline approximation is also illustrated, using pressure and volume data related to the left side of the heart. Indicator (Dye) Dilution Technique Dye dilution technique involves injecting a known amount of dye (indicator substance) into the systemic venous blood, and then continuously measuring its concentration in the systemic arterial blood. The concentration-time profile is then corrected for re-circulation. In this project, the given corrected concentration-time data were analyzed using three different numerical methods to obtain the area under curve (AUC), which in turn was used to determine cardiac output using the following formula: where “D” is the amount of dye injected into the system at time 0, c(t) is the function (which is unknown) that describes the dye concentration time profile, and T is the total sample period. In the case of our data, the dye only distribrutes through the plasma volume, which requires an additional correction for the hematocrit ( ࠵?࠵?࠵? in the equation below) to convert between the plasma volumetric flow rate ( ࠵? !"#$%# ) and the patient’s actual cardiac output ( ࠵? &’&#" or ࠵?࠵? ). ࠵? !"#$%# = ࠵? ࠵? ( ࠵? ) ࠵?࠵? ( ) and ࠵? &’&#" = ࠵?࠵? = ࠵? !"#$%# 1 − ࠵?࠵?࠵? Quadrature Methods The three numerical methods used are the Rectangular Method, Trapezoidal Method and Simpson's Rule. The formulas for each method are as follows: Rectangular: ࠵?࠵?࠵? = ℎ ∙ A ࠵? ( ࠵? * ) +,- *.- Trapezoidal: ࠵?࠵?࠵? = 2 I ࠵? ( ࠵? - ) + ࠵? ( ࠵? + )K + ℎ ∙ A ࠵? ( ࠵? * ) +,- *./ Simpson 0 s: ࠵?࠵?࠵? = 3 I ࠵? ( ࠵? - ) + 4࠵? ( ࠵? / ) + 2࠵? ( ࠵? 1 ) + 4࠵? ( ࠵? 2 ) + 2࠵? ( ࠵? 3 ) + ⋯ + 2࠵? ( ࠵? +,/ ) + 4࠵? ( ࠵? +,- ) + ࠵? ( ࠵? + )K where is the width of the partition intervals, ࠵? ( ࠵? * ) is the dye concentration at time ࠵? * , and ࠵? = 1, . . . , ࠵? . The values for the AUC are then used in the cardiac output formula above. Report Outline The remainder of this report includes: 1) a MATLAB program written to calculate three estimates of the area under the concentration-time curve, to calculate three estimates of the subject's cardiac output, and to display a plot of the concentration-time data, 2) a run of the previously-described MATLAB program, and 3) a MATLAB program to construct spline approximations to atrial, ventricular, and aortic pressure data and to ventricular volume data, along with its results.
Part 2: MATLAB program (40 points) %BME210 Sp2024 %hw1a.m solution % naming convention % Dose (mg), D % Time interval (s), h % Time points, T % Concentration measurements (mg/L), C clear; close all ; clc; %% configure parameters, read-in data readOut = load( 'DyeData_2024.txt' ); %load data from file %Assign data into my data arrays HCT= readOut(1,2) * 0.01; %hematocrit (convert from % to decimal) D = readOut(1,1); %Dose (mg) T = readOut(2:end, 1); %Time points C = readOut(2:end, 2); %Concentration measurements (mg/L) %For the time interval (h) h=T(2)-T(1) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% area under the curve (mg-sec/L) %%use rectangular rectArea = h*sum(C(1:end-1)); %%use trapezoidal trapArea = h/2*(C(1)+C(end)) + h*sum(C(2:end-1)); %%Simpson's integration %first check if the mC is odd (has to be odd numbers) if mod(length(C),2) %in case the length is odd: go ahead and use Simpson's simpsArea = h/3*(C(1) + 4*sum(C(2:2:end-1)) + ... 2*sum(C(3:2:end-2)) + C(end)); else %it is even... so just work on the numbers until n-1 and add the last separately as a trapezoid C_Odd = mC(1:end-1); %create a new myC that is an odd length. simpsArea = ... h/3*(C_Odd(1) + 4*sum(C_Odd(2:2:end-1)) + ... 2*sum(C_Odd(3:2:end-2)) + C_Odd(end)) ... + h/2*(C(end-1)+C(end)); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% myD/area will give us L/sec --> Correct Q_plasma into Q_total -> multiply by 60 to get L/min cardiacOutputRect = 60*D/rectArea/(1-HCT); cardiacOutputTrap = 60*D/trapArea/(1-HCT); Commented [BPK1]: Must read this information from the data file; it cannot be hard coded Commented [SG2]: Must code for both scenarios and test actual data to see which case it falls into Commented [SG3]: It is also acceptable to calculate the area of the first interval using the trapezoidal method and then calculate the area from the 2 nd to the n th point using Simpson’s, in which case the algorithm will be a bit different. Commented [SG4]: It is fine to skip this step and have “end – 2” instead of “end – 1” for the terms multiplied by 4 and to have “end – 3” instead of “end – 2” for the terms multiplied by 2. Commented [SG5]: Conversion to correct units and correcting for hematocrit are necessary for full credit.
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
cardiacOutputSimps = 60*D/simpsArea/(1-HCT); %all in L/min %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Display results and plot disp( 'Area approximations (mg*sec/L): ' ); fprintf( 'Rectangular = %3.3f mg*sec/L\n' ,rectArea) fprintf( 'Trapezoidal = %3.3f mg*sec/L\n' ,trapArea) fprintf( 'Simpson''s Rule = %3.3f mg*sec/L\n\n' ,simpsArea); disp( 'Cardiac output estimates (L/min): ' ); fprintf( 'Rectangular = %1.4f L/min\n' ,cardiacOutputRect); fprintf( 'Trapezoidal = %1.4f L/min\n' ,cardiacOutputTrap); fprintf( 'Simpson''s Rule = %1.4f L/min\n' ,cardiacOutputSimps); figure( 'Name' , 'hw1a' ); plot(myT, myC, 'ok' ); xlabel( 'sec' ), ylabel( 'mg/L' ); title([ 'Dye concentration vs Time (Injected dye = ' , num2str(myD) , 'mg)' ]); xlim([0.0 45.0]); ylim([0 15]); grid on ; %save figure to HW1Part2.png saveas(gcf, 'HW1Part2.png' );
Part 3: Run of Cardiac Output Program (15 points) Program Run and Discussion of Results Area approximations (mg*sec/L): Rectangular = 140.052 mg*sec/L Trapezoidal = 139.974 mg*sec/L Simpson's Rule = 139.868 mg*sec/L Cardiac output estimates (L/min): Rectangular = 5.8188L/min Trapezoidal = 5.8221 L/min Simpson's Rule = 5.8265 L/min Figure 1: Concentration-time data for a dye dilution experiment The cardiac output estimates resulting from each method are all relatively consistent, within 0.1 percent of one another. The algorithms are not entirely accurate because the dye-concentration samples are taken at finite increments and therefore the integral must be estimated since a complete closed form solution does not exist. This estimation will lead to some small amount of error. Correcting for the recirculation hump (which would have to be done before estimating the area under the concentration-time curve) will also be a source of estimation error. Additionally, the diffusion of the dye in the blood is a stochastic (i.e., random) process and therefore will always be unique and have some amount of associated random error. Commented [BPK6]: Also, can introduce error via the estimate of the dye concentrations themselves: if machine is not calibrated properly, can introduce error at very beginning of the calculations
Part 4: Spline Fit to Hemodynamic Data (30 points) %BME210 Sp2024 %hw1b.m solution clear; close all ; clc; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Read in readOutTxt = load( 'HemodynamicData.txt' ); measureNum = readOutTxt(:,1); measureTime = readOutTxt(:,2); %Time array (sec, column 2) pLeftVent = readOutTxt(:,3); %Ventricular pressure (mmHg, column 3) pAortic = readOutTxt(:,4); %Aortic pressure (mmHg, column 4) vLeftVent = readOutTxt(:,5); %Ventricular volume data (mL, column 5) pLeftAtrial = readOutTxt(:,6); %Atrial pressure (mmHg, column 6) %% Spline fitting newTime = [0:0.001:0.808]'; %Time array for spline interpolations pLeftVentSp = spline(measureTime,pLeftVent,newTime); pAorticSp = spline(measureTime,pAortic,newTime); vLeftVentSp = spline(measureTime,vLeftVent,newTime); pLeftAtrialSp = spline(measureTime,pLeftAtrial,newTime); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Plot results myfig = figure( 'Name' , 'hw1b' ); set(myfig, 'Position' , [0 0 800 600]) %Size plot %%plot the pressure data first (using the left side of the y-axis) %plot the spline estimation handlePs= plot(newTime,pLeftVentSp, 'k' , ... newTime,pAorticSp, 'k:' , ... newTime,pLeftAtrialSp, 'k--' ); %handlePs(1)=ventricular, (2)=aortic,... hold on ; %plot the original measured points handlePdLa= plot(measureTime,pLeftAtrial, 'k^' , 'MarkerFaceColor' , 'k' ); handlePdA= plot(measureTime,pAortic, 'ko' , 'MarkerFaceColor' , 'k' ); handlePdLv= plot(measureTime,pLeftVent, 'ko' ); ylabel( 'Pressure (mmHg)' ); %%Plot the volume data next (using the right side of the y-axis) yyaxis right ; %plot the spline estimation handleVs= plot(newTime,vLeftVentSp, 'k--' ); %plot the original measured points handleVd= plot(measureTime,vLeftVent, 'ks' ); ylabel( 'Volume (mL)' ); %setting the y-axis color to black currentFigureHandle = gca; currentFigureHandle.YColor = [0 0 0]; %set the axis color to black Commented [BPK7]: There are many acceptable ways of plotting the results
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
xlabel( 'sec' ); grid on ; legendHandle = legend([handlePdLa,handlePs(3), ... handlePdA,handlePs(2), ... handlePdLv,handlePs(1), ... handleVd,handleVs], ... { 'Atrial Pressure Data' , 'Atrial Pressure Spline Fit' , ... 'Aortic Pressure Data' , 'Aortic Pressure Spline Fit' , ... 'Ventricular Pressure Data' , 'Ventricular Pressure Spline Fit' , ... 'Ventricular Volume Data' , 'Ventricular Volume Spline Fit' }); set(legendHandle, 'Position' ,[0.65 0.25 0.25 0.25]); title( 'Spline fit to hemodynamic data' ); %save the fig as png saveas(gcf, 'HW1Part4.png' ); Figure 2: The markers represent left atrial, left ventricular and aortic pressures and left ventricular volume data. The lines indicate the spline interpolation fits to the data.
The mitral valve closes when the pressure in the left ventricle just begins to exceed the pressure in the left atrium (i.e., at the very beginning of the ventricular contraction). The aortic valve opens when the left ventricular pressure exceeds the aortic pressure, allowing for ejection of blood from the ventricle into the aorta. The aortic valve closes when the left ventricular pressure falls just below the aortic pressure. The mitral valve opens when the pressure in the left ventricle drops below the pressure in the left atrium, resulting in the onset of ventricular filling. At what time during the cycle (sec) does the mitral valve close? Based on a visual inspection of the atrial and ventricular pressure curves, the mitral valve closes at approximately 0.10 seconds. At what time during the cycle (sec) does the aortic valve open? The aortic valve appears to open at approximately 0.17 seconds, based on the aortic and ventricular pressure curves, as well as the ventricular volume curve. At what time during the cycle (sec) does the aortic valve close? Based on the plots of the aortic and ventricular pressures, the aortic valve appears to close at approximately 0.38 seconds, marking the end of the ejection phase. At what time during the cycle (sec) does the mitral valve open? The mitral valve appears to open at approxmately 0.48 seconds seconds; this can be seen both in the pressure plots for the atrium and ventricle, as well as in the ventricular volume plot. What is the stroke volume (mL)? The stroke volume is the difference between the end-diastolic ventricular volume (i.e., the volume of the ventricle just before contraction) and the end-systolic ventricular volume (i.e., the volume of the ventricle after contraction and ejection has occurred). Based on the plot of ventricular volume, the end-diastolic volume is roughly 155 mL and the end-systolic volume is roughly 50 mL, making the stroke volume approximately 105 mL. This stroke volume is fairly large; typical stroke volumes are generally in the range of 60 to 80 mL. What is the cardiac output (L/min)? Cardiac output can be calculated as the product of the heart rate and the stroke volume. The heart rate can be calculated by taking the inverse of the heart period. In the case of the data being analyzed, the heart period is roughly 0.8 seconds, so we can calculate the heart rate as follows: Heart Rate = 1 period = 1 0.8 seconds × 60 seconds 1 minute = 75 beats minute The stroke volume was already found to be approximately 105 mL, so multiplying the heart rate and stroke volume together, we calculate a cardiac output of roughly 7875 mL/min or 7.875 L/min. Typical values for resting cardiac output are generally in the range of 5 to 6 L/min, so this is quite large. What is the systolic blood pressure (mmHg)? The maximal aortic pressure during ventricular systole is the systolic blood pressure: approximately 115 mmHg, based on the aortic pressure curve. What is the diastolic blood pressure (mmHg)? As the left ventricle is refilling, the aortic pressure goes down and reaches its lowest pressure just before the next ventricular ejection: approximately 75 mmHg, based on the aortic pressure curve.