whtm.m

来自「Least Mean Square Newton Algorithm」· M 代码 · 共 21 行

M
21
字号
function T=whtm(n)
%This function produces a matrix of dimension n by n
%and with elements of the WHT.
%
%Format:			T=whtm(n)
%
%NOTE: n must be a power of 2.
%
p=round(log(n)/log(2));
T=ones(n)/sqrt(n);
for m=0:n-1
	for k=0:n-1
		count=0;
		for l=0:p-1
			count=count+(fix(m/(2^l))-2*fix(m/(2^(l+1)))) ...
					*(fix(k/(2^(p-1-l)))-2*fix(k/(2^(p-l))));
		end
		T(m+1,k+1)=T(m+1,k+1)*(-1)^count;
	end
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?