Explore BrainMass
Share

Explore BrainMass

    Inverse Least Squares with Matlab

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    See the attached files.

    The data for these calculations are:
    knowns.xyz contains the spectra of twenty known samples, concentrations.xyz contains the concentrations of a target chemical T in each of the twenty samples, and unknowns.xyz gives the spectra of fifteen more samples whose concentrations of T you will predict. Concentrations2xyz is just to compare values afterwards.

    Also, no particular reason for long rows vs. long columns.

    Data to apply to regression is
    *I thought I was on the right track here, but my plot is not really comparable to what it should be* Any help is greatly appreciated!

    The fundamental relationship between a measured spectral data matrix S and the associ-
    ated analyte concentration matrix C is
    S = CP + N;
    spectra are represented as matrix rows
    The ordinary least squares (OLS) estimate of the concentration values is
    C = SP^T(PP^T)^-1:
    If we want to predict the concentration of just one target chemical T in a new sample, we
    could simply use the first column of Pt(PPt)-1, call it a vector b^t, and calculate
    c = sb^t (1)
    where s is the sample's spectrum.

    1. Inverse least squares. The simplest thing you can do is to say, I can just solve
    Eq. 1 by least squares to get an estimate of b." This is called Inverse Least Squares (ILS).
    (a) Solve Eq. 1 for an algebraic expression for b.
    (b) There is an inverse in your answer. State what constraint that places on your ex-perimental design, i.e. , what balance is required between numbers of samples, wave-lengths, pure components, etc. to guarantee that the inverse will exist?
    (c) Select the intensities at the discete pixels 100, 200...1000 from the spectra in knowns
    and call this your S matrix. (In Matlab, this would mean typing something like
    >>S = S(100:100:end).) Use ILS to generate b, and then predict the concentration
    of T in unknowns. Scatter-plot your predictions versus the true values, which are
    provided in concentrations2.xyz.

    © BrainMass Inc. brainmass.com October 9, 2019, 6:59 pm ad1c9bdddf
    https://brainmass.com/computer-science/c/inverse-least-squares-matlab-104095

    Attachments

    Solution Preview

    The attached script reg.m shows how to solve the problem and just in case I also attach a jpg plot as I recall you had some problems with your Matlab.

    There are more points of confusion, such as the explanation starting with S = CP + N and C = SP^T(PP^T)^-1 goes in the wrong direction, but I have figured what you in ...

    Solution Summary

    Inverse least squares with Matlab are featured and discussed in the solution.

    $2.19