LPFCSD_Example_1

This example compares the convergence of LPF/TVD and LPF/CSD (with lam0 = 0 in LPF/CSD). LPF/TVD is seen to have faster convergence for this example.

Ivan Selesnick,
Polytechnic Institute of NYU,
June 2012

Contents

Start

clear
close all

Load data

y = load('wl2_col38.txt');

Fs = 6.25;   % Fs : sampling rate (samples/second)
N = length(y);
n = 1:N;
t = n/Fs;

figure(1)
clf

subplot(2,1,1)
plot(t, y);
xlim([0 N/Fs])
title('Data')
xlabel('Time (sec)')

LPF/TVD algorithm

fc = 0.02;          % fc : cut-off frequency (cycles/sample) (0 < fc < 0.5);
d = 1;              % d : filter order parameter (d = small positive integer)

lam = 1.2;
Nit = 200;

[x_lpftvd, f_lpftvd, cost_lpftvd] = lpftvd(y, d, fc, lam, Nit);       % Run LPF/TVD algorithm

txt = sprintf('fc = %.2e, d = %d, lam = %.2e', fc, d, lam);

LPF/CSD algorithm

With lam0 = 0, LPF/CSD should in principle, give same output as the LPV/TVD algorithm. It is close, but not exact!

% mu : ADMM parameter for LPF/CSD

lam0 = 0;

mu1 = 0.05;
[x_csd_mu1, f_csd_mu1, cost_csd_mu1] = lpfcsd(y, d, fc, lam0, lam, Nit, mu1);

mu2 = .5;
[x_csd_mu2, f_csd_mu2, cost_csd_mu2] = lpfcsd(y, d, fc, lam0, lam, Nit, mu2);

txt1 = sprintf('fc = %.2e, d = %d, lam0 = %.2e, lam1 = %.2e', fc, d, lam0, lam);

Display cost function history

figure(1)
clf
plot(1:Nit, cost_csd_mu1, '--', 1:Nit, cost_csd_mu2, '-.', 1:Nit, cost_lpftvd)
title('Cost function history')
xlabel('Iteration')
legtxt1 = sprintf('LPF/CSD (\\mu = %.2f)', mu1);
legtxt2 = sprintf('LPF/CSD (\\mu = %.2f)', mu2);
legend(legtxt1, legtxt2, 'LPF/TVD')
ylim([280 345])

print -dpdf figures/LPFCSD_Example_1

Display TVD components

figure(2)
clf

subplot(2, 1, 1)
plot(t, x_lpftvd)
xlim([0 N/Fs])
title('TVD component (LPF/TVD)')
xlabel(txt)

subplot(2, 1, 2)
plot(t, x_csd_mu1)
xlim([0 N/Fs])
xlabel(txt1)
title('TVD component (LPF/CSD)')