i need to Compute the coefficient teta of parameter of the AR-2D model described by:
X(i,j)=teta(1,0)*X(i-1,j)+teta(0,1)*X(i,j-1)+e(i,j)
X it is blocks of image
i=imread('D1.gif');i= im2double(i);x = imresize( i,0.25);[m,n] = size(x);noise=randn(size(x));X = mat2cell(x, 80 * ones(1,m/80), 80 * ones(1,n/80));
**this the function**
function [teta,k] =ls( X,x,noise) global m n global R C p1=1; p2=1; % for r = 1+p1 : R
% for c = 1+p2 : C
for i=1+p1:R for j=1+2:C X(i,j)= teta(1,0)*X(i-1,j)+teta(0,1)*X(i,j-1)+noise(i,j); X=X+1; end end teta= (inv(x'*X))*(x'*X) end
i have problem in this function
Best Answer