📄 thfig44.m
字号:
% thfig44: BP Thesis Figure 4.4 -- Dictionary Cycling
% Signal: HeaviSine
% Signal Length: 64
% Dictionary
% 1st Dictionary: 2-overcomplete discrete sine dictionary
% 2nd Dictionary: HeaviSide
% Warning: LSSOL is required to run this file.
% Observation:
% (a) The signal: HeaviSine
% (b) Step 1 - BP using only DST: DST coef
% (c)-(d) Step 2 - Swap in HS: DST coef and HS coef
% (e)-(f) Step 3 - Swap in DST: DST coef and HS coef
% Notice the iterative approach quickly converges in this case
% Warning: This requires LSSOL
%
help thfig44
n = 64; t = (1:n)' / n;
x = InputSignal('HeaviSine', n);
%%DST
FDST = MakeDict(n, 'DST', 1, 0, 0);
c0 = zeros(n,1) -1;
c1 = BP_Simplex(x, FDST, c0);
c1DST = c1;
%%Swap in HS
indexDST = c1DST ~= 0;
FHS = MakeDict(n, 'HS');
F = [FDST(:, indexDST) FHS];
[temp m] = size(F);
c0 = [c1DST(indexDST); zeros(n,1)];
c2 = BP_Simplex(x, F, c0);
c2DST = zeros(n,1); c2HS = zeros(n,1);
c2DST(indexDST) = c2(1:length(indexDST));
c2HS = c2((length(indexDST)+1):m);
%%Swap in DST
F = [FDST FHS];
c0 = [c2DST; c2HS];
c3 = BP_Simplex(x, F, c0);
c3DST = c3(1:n);
c3HS = c3((n+1):(2*n));
figure(1);clf
subplot(3,2,1); plot(t, c1DST); title('(a) Step 1: DST Coefs');
xlabel('Frequency/Nyquist')
subplot(3,2,2); plot(t, zeros(n,1)); title('(b) Step 1: HS Coefs');
xlabel('Position')
subplot(3,2,3); plot(t, c2DST); title('(c) Step 2: DST Coefs');
xlabel('Frequency/Nyquist')
subplot(3,2,4); plot(t, c2HS); title('(c) Step 2: HS Coefs');
xlabel('Position')
subplot(3,2,5); plot(t, c3DST); title('(c) Step 3: DST Coefs');
xlabel('Frequency/Nyquist')
subplot(3,2,6); plot(t, c3HS); title('(c) Step 3: HS Coefs');
xlabel('Position')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -