Equation code?
5 views (last 30 days)
Show older comments
Hi,
I wrote the following code for this equation :
M=(1/K)*sum(zkd*zkd')
,and it's running with out errors ,but all the elements in matrix M (1000*1000) are of the same value (1.1180e+001),and Mz is just one single value (1.7619e+001)despite it should be (1000*1000).Can anybody help,please?
clear all;
clc
load lab2_data;
x = radar_noise; % input signal
K = 1000; % K CAPITAL is Block Size
L = length(x) - mod(length(x),K); % only full blocks
zkd = reshape(x(1:L), K, []);
M=zeros(K,K); % M ZEROS covariance matrix L*L
for i=1:size(zkd,1); % LOOP covariance matrix calculation
Mz=zkd(i,:)*zkd(i,:)'; %
M=M+Mz;
end
M=M/K;
0 Comments
Accepted Answer
Walter Roberson
on 12 Dec 2011
zkd(i,:) is going to be 1 by L.
zkd(i,:)' is going to be L by 1.
Doing a matrix multiplication of a (1 by L) and (L by 1) is going to result in a 1 by 1.
Perhaps you want
zkd(i,:)' * zkd(i,:)
0 Comments
More Answers (0)
See Also
Categories
Find more on Array and Matrix Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!