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
Image Analyst
2014년 8월 15일
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?
답변 (1개)
Roger Stafford
2014년 8월 15일
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.
카테고리
도움말 센터 및 File Exchange에서 Correlation and Convolution에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!