lptransform.m
来自「Signal and Sytem Using Matlab 书的源代码 注释详尽」· M 代码 · 共 34 行
M
34 行
% Example 8.24 低通滤波器的设计(此为网站参考程序)
%
% Analog Butterworth filter design
%
% design an 3-pole filter with a bandwidth of 5 Hz
%
[z,p,k] = buttap(3); % 3 pole filter
[b,a] = zp2tf(z,p,k); % convert the zeros and poles to polynomials
wb = 5*2*pi; % new bandwidth in rad/sec
[b,a] = lp2lp(b,a,wb); % transforms to the new bandwidth
f = 0:15/200:15; % define the freq. in Hz for plotting
w = 2*pi*f;
H = tf(b,a);
[mag1,phase1] = bode(H,w);
% print to MATLAB command window
% fprintf('2 pole filter \n')
% disp('b = ');disp(b');
% disp('a = ');disp(a');
%plot versus frequency in Hz
clf
subplot(211)
mag = squeeze(mag1);%squeeze函数用来删去大小为1的"孤维"
phase = squeeze(phase1);
plot(f,mag)
ylabel('|H| dB')
xlabel('Frequency (Hz)')
title('Example 8.24 Lowpass Filter Design')
subplot(212)
plot(f,phase)
ylabel('Angle(H), degrees')
xlabel('Frequency (Hz)')
subplot(111) %这个语句没太明白在此处什么用意
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?