mpdn.m
来自「% Atomizer Main Directory, Version .802 」· M 代码 · 共 64 行
M
64 行
function [xrec, coef] = MPDN(y, NameOfDict, par1, par2, par3)
% MPDN -- Matching Pursuit DeNoising (Forward Stepwise Regression)
% Usage
% [xrec, coef] = MPDN(y, NameOfDict, par1, par2, par3)
% Inputs
% y 1-d signal to be de-noised; column vector
% NameOfDict string; name of the dictionary
% par1,par2,par3 parameters of the dictionary
%
% Use 'help dictionary' for dictionary objects: NameOfDict,par1,par2,par3
% Outputs
% xrec cleaned signal; column vector
% coef coeff of cleaned signal; column vector
% Description
% 1. Assumes noise level == 1
% 2. MPDN runs MP until the coef of the selected atom is less than
% the threshold sqrt(2 * log(m)), where m is the cardinality
% of the dictionary
% See Also
% MP
%
%Size of the problem
y = y(:);
n = length(y);
[m, L] = SizeOfDict(n, NameOfDict, par1, par2, par3);
%Set the threholding level
thresh = (2 * log(m)) ^ .5;
%Matching Pursuit with frac * norm(y) = thresh
zerosm = zeros(m,1);
nrm = norm(y);
resnorm = nrm;
amp = nrm;
residule = y;
coef = [];
index = [];
k = 0;
amp = 2 * thresh;
fprintf('\nMPDeNoise:\n')
while (amp > thresh),
c = FastA(residule, NameOfDict, par1, par2, par3);
[amp i] = max(abs(c));
i = i(1);
index = [index; i];
coefnew = c(i);
coef = [coef; coefnew];
temp = zerosm; temp(i) = 1;
residule = residule - coefnew * FastS(temp, n, NameOfDict, par1, par2, par3);
resnorm = norm(residule);
k = k + 1;
disp(sprintf('Step%4g: select = %5g coef = %10.2e', k,i,coefnew));
end
h = length(coef);
coefbest = zeros(m, 1);
for i = 1:h,
coefbest(index(i)) = coefbest(index(i)) + coef(i);
end
coef = coefbest;
xrec = FastS(coef, n, NameOfDict, par1, par2, par3);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?