📄 bpfig32.m
字号:
% bpfig32: BP Figure 3.2 -- Analyzing FM-Cosine
%----------------------------------------------------------------------
% Signal: FM-Cosine
% s = .5*cos(n*pi*.5*t)
% + cos(n*pi*(t/2 + .5*cos(2*w*pi*t)/(4*w*pi)))
% where w = 4
% Signal Length: 1024
% Dictionary: Cosine Packets with D = log2(n)-4
% Observations:
% (a) FM-Cosine.
% (b) The ideal phase plane: a sinosoid plus a frequency modulated
% oscillating cycles (four cycles).
% (c) MOF plane gives a weak and smeared-out description of the FM
% structure.
% (d) BOB cannot resolve the nonorthogonality between the sinusoid
% and the FM structure.
% (e) MP cannot resolve the similarity among the 4 cycles in the
% FM structure. It completely misses the FM structure.
% (f) BP gives a good description of both the sinusoid and the
% FM structure.
%
% Use:
% bpfig32 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 bpfig32
bpengine;
n = 1024; D = log2(n); bell = 'Sine'; t = (1:n)' / n;
x = InputSignal('FM', n);
time = cputime;
cMOF = MOF(x, 'CP', D-4, bell, 0);
time1 = cputime - time;
time = cputime;
cBOB = BOB(x, 'CP', D-4, bell, 0);
time2 = cputime - time;
time = cputime;
cMP = MP(x, 'CP', D-4, bell, 0);
time3 = cputime - time;
time = cputime;
switch ATOMIZER_ENGINE
case 1998
cBP = BP_Interior (x, 'CP', D-4, bell, 0);
case 2001
cBP = BP_Interior2(x, 'CP', D-4, bell, 0);
end
time4 = cputime - time;
fprintf('\n')
fprintf('CPU Running Time of MOF = %8.4e\n', time1);
fprintf('CPU Running Time of BOB = %8.4e\n', time2);
fprintf('CPU Running Time of MP = %8.4e\n', time3);
fprintf('CPU Running Time of BP = %8.4e\n', time4);
%--------------------
% Plots
%--------------------
fprintf('\nConstructing figure(%1g) ...\n', FIGURE)
figure(FIGURE); clf reset;
subplot(3,2,1); plot(t, x);
title('(a) Signal: FM');
subplot(3,2,2); axis([0 1 0 1])
plot(t, .5*ones(1024, 1));
hold on
w = 4;
sig = cos(n * pi * (t/2 + .5 * cos(2*w * pi * t) / (4*w*pi)));
sig = sig + cos(n * pi * .5 * t) * .5;
tf = 1/2 + .25 * sin(2 * w * pi * t);
plot(t, tf); title('(b) Phase Plane: Ideal');
xlabel('Time'); ylabel('Frequency')
TFScale = 20;
subplot(3,2,6); PhasePlane(cBP, 'CP', n, 0, 256, TFScale);
title('(f) PhasePlane: BP');
subplot(3,2,5); PhasePlane(cMP, 'CP', n, 0, 256, TFScale);
title('(e) PhasePlane: MP');
subplot(3,2,4); PhasePlane(cBOB, 'CP',n, 0, 256, TFScale);
title('(d) PhasePlane: BOB');
subplot(3,2,3); PhasePlane(cMOF, 'CP',n, 0, 256, TFScale);
title('(c) PhasePlane: MOF');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -