Matrix regression- how to make?

1 Ansicht (letzte 30 Tage)
Nata Salt
Nata Salt am 23 Jan. 2015
Kommentiert: Matt J am 23 Jan. 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?

Antworten (1)

Matt J
Matt J am 23 Jan. 2015
Bearbeitet: Matt J am 23 Jan. 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 Kommentare
Nata Salt
Nata Salt am 23 Jan. 2015
May be a loop? for each matrix raw?
Matt J
Matt J am 23 Jan. 2015
which converts one matrix value to another one
I think you'll need to define for us what that means.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Polynomials finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by