Matrix regression- how to make?

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?

답변 (1개)

Matt J
Matt J 2015년 1월 23일
편집: Matt J 2015년 1월 23일

0 개 추천

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

Nata Salt
Nata Salt 2015년 1월 23일
Thank you, I did not know that I can not use matrix... If there is another function to find the polynom which converts one matrix value to another one?
Nata Salt
Nata Salt 2015년 1월 23일
May be a loop? for each matrix raw?
Matt J
Matt J 2015년 1월 23일
which converts one matrix value to another one
I think you'll need to define for us what that means.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Polynomials에 대해 자세히 알아보기

질문:

2015년 1월 23일

댓글:

2015년 1월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by