haardecomposition.m

来自「一本很简单」· M 代码 · 共 26 行

M
26
字号
function y = HaarDecomposition(x, normalization)% HaarDecomposition(x) returns the Haar wavelet decomposition of x.% The normalization can be either 'max' or 'L2'.% Check length of x.len = length(x);j = log(len)/log(2);if len ~= 2^j  error('HaarDecomposition: x must be a vector of length 2^j.');end;% Copy input, scaled appropriately for normalization.if strcmp(normalization, 'L2')  y = x/2^(j/2);else  y = x;end;% Repeatedly do summing and differencing on shorter and shorter part of y.while len >= 2  y = HaarDecompStep(y, len, normalization);  len = len/2;end;return;

⌨️ 快捷键说明

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