program_08_07.m

来自「自编的一些小波源程序,用MATLAB编的.希望对那些喜欢小波的人有所帮助.去解压」· M 代码 · 共 27 行

M
27
字号
% Program 8_7
% Illustration of Lowpass Digital Filtering
%
clf
% Generate the input sequence
k = 1:51;
w1 = 0.8*pi;w2 = 0.1*pi;
A = 1.5;B = 2.0;
x1 = A*cos(w1*(k-1)); x2 = B*cos(w2*(k-1));
x = x1+x2;
si = [0 0 0];
b = 0.0662272*[1 3 3 1];
a = [1 -0.9356142  0.56712691  -0.10159107];
y = filter(b,a,x,si);
stem(k-1,x2);axis([0 50 -2 2]);
xlabel('Time index n'); ylabel('Amplitude');
title('Desired component of the input sequence');
pause
stem(k-1,y);
xlabel('Time index n'); ylabel('Amplitude');
title('Output sequence generated by function filter ');
pause
si = [0 0 0];
y2 = filtfilt(b,a,x);
stem(k-1,y2);
xlabel('Time index n'); ylabel('Amplitude');
title('Output sequence generated by function filtfilt');

⌨️ 快捷键说明

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