examp_dgt.m

来自「linear time-frequency toolbox」· M 代码 · 共 77 行

M
77
字号
%EXAMP_DGT  How to call a DGT%%   This script sets up a Gabor frame with the specified%   parameters (a, M, L defined below), computes a window%   and the corresponding canonical dual  window and a test signal,%   and plots the windows and the energy of the coefficients.%%   FIGURE 1 window+dual%%    This figure shows a Gaussian used as the window function%    and its canonical dual. %%   SEE ALSO:  DGT, IDGT, PGAUSSdisp('Type "help examp_dgt" to see a description of how this example works.');% Setup parameters and length of signal.% Not that it must hold that L=M*b=N*a for some integers% M and N, and that a*b <= LL=480;  % Length of signal.a=20;   % Time shift.M=24;   % Number of modulations.% From the parameters L, a and M we can calculate:b=L/M;  % Length of frequency shift.N=L/a;  % Number of time shifts.% Get a good window and its canonical dual.g=pgauss(L,a/b);gamma=candual(g,a,M);% Plot them:% Standard note on plotting:%% - The windows are all centered around zero, but this%   is not visually pleasing, so the window must be%   shifted to the middle by an FFTSHIFTfigure(1);subplot(2,1,1);plot(fftshift(g));title('Periodized gaussian.');legend('off');subplot(2,1,2);plot(fftshift(gamma));title('Canonical dual window.');legend('off');% Setup a complex test signal.ftest=ctestfun(L);% Calculate coefficients.coef=dgt(ftest,gamma,a,M);% Plot the energy of the coefficients.% To visualize the coefficients, we must move the center frequency to% the middle of the plot.figure(2);imagesc(abs(fftshift(coef,1)).^2);% Test reconstructionftest_r=idgt(coef,g,a);% Print relative error of reconstruction.disp('');disp('Relative error of reconstruction, should be close to zero.');norm(ftest-ftest_r)/norm(ftest)

⌨️ 快捷键说明

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