Inverse Least Squares with Matlab
Not what you're looking for?
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.
Purchase this Solution
Solution Summary
Inverse least squares with Matlab are featured and discussed in the solution.
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 ...
Purchase this Solution
Free BrainMass Quizzes
Word 2010: Tables
Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.
Word 2010: Table of Contents
Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.
Basic Networking Questions
This quiz consists of some basic networking questions.
Inserting and deleting in a linked list
This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.
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.