\-operator to perform least squares fit on multiple sample-sets
Mostrar comentarios más antiguos
Is there a matrix expansion of the \-operator that enables least squares fit of y = M\x where M is an m-by-n-by-p matrix and x is an m-length vector m=[3 .. 10]; n =3 for order 2?
1 comentario
Andrew Newell
el 19 de En. de 2012
What length does y have and how many sets of x do you have?
Respuestas (2)
Andrew Newell
el 19 de En. de 2012
If I understand your question, you are trying to estimate y given multiple measurements of x. Note that if M were a matrix, the correct least squares estimate would be
yhat = (M'*M)\(M'*x);
You would be well advised to recast your problem. Instead of several vectors x, make one vector X containing all the data. Then reshape M so
y = M*X;
and then use the above expression.
6 comentarios
Eugene
el 21 de En. de 2012
Eugene
el 21 de En. de 2012
Andrew Newell
el 21 de En. de 2012
So what you're really trying to do is to fit second order polynomials y=a*x^2+b*x+c to the data?
Eugene
el 21 de En. de 2012
Andrew Newell
el 22 de En. de 2012
I'm not sure what you mean by "curve". To me, a set of (x,y) values represents points on a curve - in the example above, you would have four curves, one for each row of X.
Eugene
el 24 de En. de 2012
Categorías
Más información sobre Linear Algebra en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!