How can I get measured data and simulated data to match?

I have some measured data and some simulated data and I have to get the best match with the least square method. I want to multiplicate the simulated data with a variable and add a variable to accomplish this.
Is there already a program for this, respectively how could I solve this?

 Respuesta aceptada

Greg Heath
Greg Heath el 13 de Sept. de 2012
If
[ I N ] = size(measured)
Solve the matrix equation
W*[ ones(1,N); simulated ] = measured

3 comentarios

Monika
Monika el 13 de Sept. de 2012
I don't think Matlab can solve this, there are more equations than variables. And where does least square come in?
To complete Greg's code:
L = [ ones(1,N); simulated];
W = measured / L;
The least-squares fitting is implicitly done by Matlab in the matrix division (/). This works even if there are more equations than variables.
Monika
Monika el 14 de Sept. de 2012
Thank you both very much, it works perfectly :-)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

el 13 de Sept. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by