MATLAB polyfit find P50 in mmHg
Not what you're looking for?
How do I convert back to find P50 in mmHg and n given the best-fit?
function po2()
%This function tests the linearty of tetrameric bovine hemoglobin binding
%to oxygen as a possible blood substitute for monomeric hemoglobin. An
%oxygen dissociation curve is created, and a linear regression is performed
%on the experimental data using the built in Matlab function, polyfit. A
%best-fit model is plotted with the data to show that linearty exists.
% this is the data provided
pO2 = [ 10 20 30 40 50 60 70 80 90 100 110 120 ] ;
Y = [0.18 0.4 0.65 0.8 0.87 0.92 0.94 0.95 0.95 0.96 0.96 0.97 ] ;
% Test the linearity according to Henry's Law and the Hill equation
%ln(Y/(1-Y)) = n*ln(pO2)+n*ln(P50) which captures the sigmoidal shape of
%the oxygen dissociation curve
x = log(pO2) ;
yy = log( Y ./(1-Y) ) ;
p = polyfit( x, yy, 1) ;
fitted = p(1) * x + p(2) ; %define equation for best-fit line
subplot(1,2,1) ;
hold ;
plot(pO2, Y, 'o', 'LineWidth',2) ;
hold ;
legend('Oxygen Dissociation Curve') ;
xlabel('pO2 in mmHg', 'FontSize', 12, 'FontWeight', 'bold') ;
ylabel('Fraction of Hb Saturation in %', 'FontSize', 12, 'FontWeight', 'bold') ;
subplot(1,2,2) ;
hold ;
plot( x, yy, 'o', 'LineWidth', 2) ; % here plot the provided data
plot( x, fitted, ':', 'LineWidth', 2) ; % here plot the linear fit
xlabel('log(pO2) in mmHg', 'FontSize',12, 'FontWeight','bold') ;
ylabel('log(Y /(1-Y))in % Saturation', 'FontSize',12, 'FontWeight','bold') ;
legend('Linear Regression of Oxygen Dissociation Curve', 'Fitted line', 2) ;
hold ;
Purchase this Solution
Solution Summary
The expert uses the MATLAB polyfit function to find P50 mmHg.
Solution Preview
We have the following relations:
ln(Y/(1-Y)) = n*ln(pO2)+n*ln(P50) ---[1]---
was given as the definition of what we want to fit, when we took ...
Purchase this Solution
Free BrainMass Quizzes
Excel Introductory Quiz
This quiz tests your knowledge of basics of MS-Excel.
Java loops
This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.
C# variables and classes
This quiz contains questions about C# classes and variables.
Basic UNIX commands
Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.
Basic Networking Questions
This quiz consists of some basic networking questions.