How to take values from a workspace, multiply them by a variable and plot the result?

2 views (last 30 days)
Hi,
I have two workspace arrays that are 51x1. One is for DeoxyHemoglobin and the other is for OxyHemoglobin. I need to plot them against eachother when there is 90% of Oxy to 10% Deoxy and go from 90-10 and 10-90, respectively. If this was not clear, an example would be, take the value from the Oxy_Hb_450_700 at 1x1 and multiply it by 10 and then the value from Doxy_Hb_450_700 at 1x1 and multiply it by 90, add them together and plot that against my x1 which stays the same. I know that I must use a for loop. I renamed the workspaces as variables so it was easier to work with. Then I created a for loop with a variable i so it is easier to input. But I don't think I wrote the correct code because when I run the script, all I get is the graph of y2. I don't think this is the answer.
y1=Oxy_Hb_450_700;
y2=Doxy_Hb_450_700;
y3=Met_Hb_450_700;
x1=wavelength_450_700;
for i=10:10:90;
plot (x1, y1(:,end)*i + y2(:,end) * (100-i));
end
PLEASE HELP!

Accepted Answer

Star Strider
Star Strider on 5 Oct 2015
Are you plotting oxyhaemoglobin against deoxyhaemoglobin (for instance as derived from spectrophotometric measurements at different wavelengths), an oxyhaemoglobin dissociation curve, or something else?
Do you want to derive percent oxygen saturation from them?
Do the rows in each vector correspond to the same sample (for instance, sampling time) or are they random?
It would be easier to sort this if you posted your data (preferably as a .mat file).
  2 Comments
Joseph
Joseph on 5 Oct 2015
I have attached the .mat file I'm using. I'm only using the ones entitled Doxy_Hb_450_700 and Oxy_Hb_450_700.
They are derived from spectrophotometric measurements. All I want to do, is take the data from both of the workspaces and create a graph where it is 90% of the Oxy value and 10% of the Deoxy Value vs the Wavelength, then 80% of the Oxy Value and 20% of the Deoxy Value vs the Wavelength, until I reach 10% of Oxy and 90% of Deoxy. These points will create a graph and that is what I need.
Star Strider
Star Strider on 5 Oct 2015
This is my initial analysis:
D = load('hb_ext_coeffs_450_700.mat');
HbO2 = D.Oxy_Hb_450_700;
HbDO2 = D.Doxy_Hb_450_700;
MHb = D.Met_Hb_450_700;
Wvl = D.wavelength_450_700;
L660 = find(Wvl == 660); % Index = 660 nm
PctSat = HbO2(L660)./(HbO2(L660) + HbDO2(L660) + MHb(L660)); % Percent HbO2 Saturation
figure(1)
plot(Wvl,HbO2,'-r', Wvl,HbDO2, '-b', Wvl,MHb,'-m')
grid
legend('Hb_{O_2}', 'Reduced Hb', 'MetHb', 'Location', 'NE')
You can get one value of oxyhaemoglobin saturation from these data, because this is one measurement, and I calculate it as 44%, so it is clearly a venous sample.
One of the articles my PubMed search turned up, ‘A review of the principles of pulse oximetry and accuracy of pulse oximeter estimates during exercise’, mentions that the HbO2 percent saturation is measured at 660 nm, so that is how I calculated it. (Fortunately, you measured it at exactly that value, so I didn’t have to do any interpolation.) If you have a reference appropriate to your spectrophotometric method that suggests a different analysis procedure, I will help you analyse it further. Be certain to include the complete PDF of the article, because I might not have free access to it.

Sign in to comment.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!