Equation code?

3 ビュー (過去 30 日間)
zayed
zayed 2011 年 12 月 12 日
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;

採用された回答

Walter Roberson
Walter Roberson 2011 年 12 月 12 日
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 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by