cross correlation matrix dimension

clc;
close all;
clear all;
X=[1 1 1;1 1 1]
H=[1 2; 3 4; 5 6]
[M N]=size(X);
[P Q]=size(H);
k=1;
l=2;
for m=1:1:M;
for n=1:1:N;,
C=sum(sum(X(m,n).*conj(H(m+k,n+l))))
end
end

1 comentario

Image Analyst
Image Analyst el 15 de Ag. de 2014
Other than "How can I format my code in the Answers forum?" which I did for you and you can do for yourself after you read this, do you have another question?

Iniciar sesión para comentar.

Respuestas (1)

Roger Stafford
Roger Stafford el 15 de Ag. de 2014
The nested for-loops are not doing what you appear to have in mind. You are doing a summation on scalars there. Also some of the column indices for the H array you have defined will fall out of its range and you will get an error message.
Ignoring the problem of out-of-range indices, you appear to want this:
k = 1;
l = 2; % <--Lowercase L
C = sum(sum(X.*H(k+1:k+M,l+1:l+N))); % <--Lowercase L
As Image Analyst indicates, you should always state what your question is.

Etiquetas

Preguntada:

el 15 de Ag. de 2014

Respondida:

el 15 de Ag. de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by