⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bpfig51.m

📁 % Atomizer Main Directory, Version .802 里面信号含有分解去噪合成过程的代码 %---------------------------------------
💻 M
字号:
% bpfig51: BP Figure 5.1 -- DeNoising noisy Gong
%----------------------------------------------------------------------
% Signal:        Gong, SNR = 1
% Signal Length: 1024
% Dictionary:    Cosine Packets with D=log2(n)
% Observations:
%    (a) Signal: Gong.
%    (b) Noise:  SNR = 1.
%    (c) Denoising by MOF: It doesn't help at all due to simple linear
%        shinkage.
%    (d) Denoising by BOB: cannot quite recover the fine decaying
%        structure.
%    (e) Denoising by MP: cannot quite recover the fine decaying
%        structure.
%    (f) BPDenoising: it recovers the fine decaying structure.
%
% Use:
%    bpfig51                   uses the current solver.
%    ATOMIZER_ENGINE = 1998;   selects original solver.
%    ATOMIZER_ENGINE = 2001;   selects later    solver.
%    Default is most recent solver.
%----------------------------------------------------------------------

%----------------------------------------------------------------------
%        1998: (S. Chen) Original script for BP paper.
% 09 Apr 2001: (M. Saunders) Choice of solvers implemented.
%----------------------------------------------------------------------

help bpfig51
bpengine;

n = 1024;
D = log2(n); 
x = InputSignal('Gong', n);
t = (1:n)';
x = cos(t * (pi/4)) ./ sqrt(t);
m = floor(3*n/4);
x = [zeros(n-m,1); x(1:m)];

SNR   = 1;   %Noise level = 1
randn('seed', 2.055615866000000e+09);
[x y] = NoiseMaker(x, SNR);
sigma = 1;

time    = cputime;
xrecMOF = MOFDN(y, 'CP', D, 'Sine', 0);
time1   = cputime - time;

time    = cputime;
xrecBOB = BOBDN(y, 'CP', D, 'Sine', 0);
time2   = cputime - time;

time    = cputime;
xrecMP  = MPDN(y, 'CP', D, 'Sine', 0);
time3   = cputime - time;

%-------------------------------------
% BP
%-------------------------------------
time    = cputime;
switch ATOMIZER_ENGINE
   case 1998
      xrecBP = BPDN_Interior (y, 'CP', D, 'Sine', 0);
   case 2001
      xrecBP = BPDN_Interior2(y, 'CP', D, 'Sine', 0);
end
time4   = cputime - time;

fprintf('\n')
fprintf('CPU Running Time of MOFDN = %8.4e\n', time1);
fprintf('CPU Running Time of BOBDN = %8.4e\n', time2);
fprintf('CPU Running Time of  MPDN = %8.4e\n', time3);
fprintf('CPU Running Time of  BPDN = %8.4e\n', time4);

%--------------------
% Plots
%--------------------
fprintf('\nConstructing figure(%1g) ...\n', FIGURE)
figure(FIGURE);   clf reset;

t = (1:n)' / n;
subplot(3,2,1);   plot(t, x);
                  title('(a) The Truth')
                  AXIS = axis;
subplot(3,2,2);   plot(t, y); 
                  titlestr = sprintf('(b) Noisy Gong: SNR = %g', SNR);
                  title(titlestr)
subplot(3,2,3);   plot(t, xrecMOF);
                  title('(c) Recovered: MOF')
                  axis(AXIS);
subplot(3,2,4);   plot(t, xrecBOB);
                  title('(d) Recovered: BOB')
                  axis(AXIS);
subplot(3,2,5);   plot(t, xrecMP);
                  title('(e) Recovered: MP')
                  axis(AXIS);
subplot(3,2,6);   plot(t, xrecBP);
                  title('(f) Recovered: BP')
                  axis(AXIS);
subplot(3,2,3);   AXIS = axis;
subplot(3,2,1);   title('(a) Signal: Gong');
                  axis(AXIS);
subplot(3,2,2);   axis(AXIS);

⌨️ 快捷键说明

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