Linear Fitting of Multiple X,Y Datasets with Independent Z Variable
Show older comments
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
on 16 Oct 2013
It would seem it's then just 300 separate fits of abs=f(conc), one for each wavelength.
That's easily set up in an array with a loop along columns or arrayfun() using polyfit()
Or, could write it explicitly for the whole array and return array of coefficients and use the backslash operator.
Soren
on 16 Oct 2013
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... :)
Answers (0)
Categories
Find more on Linear and Nonlinear Regression 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!