Linear Fitting of Multiple X,Y Datasets with Independent Z Variable

1 view (last 30 days)
I have a 3D array of wavelength, concentration, and absorbance. To calculate the molar absorptivity of this compound I need to perform a linear least squares fit of the concentration vs. absorbance data for each wavelength. There are 6 concentration and 6 absorbance values for each one of the 300 wavelength values.
How can I go about performing this fit? Is it best to iteratively fit the concentration vs. absorbance data for each wavelength?
The final result I am looking for is a slope and standard deviation for each wavelength.
Thanks in advance for the help!
  4 Comments
dpb
dpb on 16 Oct 2013
Well, is there any advantage in fitting a surface instead of N lines first? Is there any possibility owing to physical process that there is an interactive term that should be estimated? Etc., etc., etc., ...
First rule of coding is one has to have a clear definition... :)
Soren
Soren on 17 Oct 2013
Edited: Soren on 17 Oct 2013
The wavelength does have a direct bearing on the absorbance. However, this is a quantum mechanical effect having to do with excited state energy levels and the transition dipole moment, etc.
What I am trying to do here is fit Beer's Law to the absorbance data. The formula for this does not implicitly account for the basis of the changes of absorbance with wavelength, it just realizes that each wavelength will have a different absorption coefficient:
Absorbance(n) = epsilon(n)*concentration
So, arrayfun with polyfit seems to be the way to go. I have played around with this, but I am having syntax and other issues.
X = concentration / (1x6 array)
Y = absorbance / (311x6 array)
arrayfun(polyfit(X,Y?,1),???)
How do I pass polyfit the 1x6 array of absorbance values for a given wavelength (i.e. Y(n) = absorbance(n,:))? How can I get a readable list of wavelength, slope, and error?

Sign in to comment.

Answers (0)

Categories

Find more on Particle & Nuclear Physics in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!