Matrix regression- how to make?

1 visualización (últimos 30 días)
Nata Salt
Nata Salt el 23 de En. de 2015
Comentada: Matt J el 23 de En. de 2015
Hi . I am completely new in Matlab and programming in general. I am trying to find a polynomial which would convert values from my image data to the mean value of this array. right now I have something like that:
A= importdata( '1slide.tif');
% Rewrite the image in matrix
B= im2uint16(A);
% Find the mean value
M=mean2(B);
E= ones (2048,2048,'uint16');
Mat = M *(E);
Poly= polyfit(B,Mat,6);
A= importdata( '1slide.tif');
% Rewrite the image in matrix
B= im2double(A);
% Find the mean value
M=mean2(B);
E= ones (2048,2048,'double');
Mat = M *(E);
Poly= polyfit(B,Mat,6)
But I got an error:
Undefined function 'qr' for input arguments of type 'uint16'.Error in polyfit (line 66)[Q,R] = qr(V,0);
Why do I need these QR? What should I use for them?

Respuestas (1)

Matt J
Matt J el 23 de En. de 2015
Editada: Matt J el 23 de En. de 2015
The input arguments to polyfit are not supposed to be matrices and they are not supposed to be of integer type. Polyfit will perform a single 1D polynomial fit to a vector of x,y data (singles or doubles) that lie on the polynomial.
To better advise, we'd have to know what you're expecting by passing matrices to polyfit instead of vectors.
  3 comentarios
Nata Salt
Nata Salt el 23 de En. de 2015
May be a loop? for each matrix raw?
Matt J
Matt J el 23 de En. de 2015
which converts one matrix value to another one
I think you'll need to define for us what that means.

Iniciar sesión para comentar.

Categorías

Más información sobre Polynomials en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by