📄 ex6_1.m
字号:
%%%%%%%%%%%%%%%%%% Example 6.1 %%%%%%%%%%%%%%%%%%
% Discrete-Time Control Problems using %
% MATLAB and the Control System Toolbox %
% by J.H. Chow, D.K. Frederick, & N.W. Chbat %
% Brooks/Cole Publishing Company %
% September 2002 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ---- Butterworth filter ----
%
%clear
disp('Example 6.1')
Ts = 0.1 % sampling period
num = 0.2066*[1 2 1]; % filter numerator
den = [1 -0.3695 0.1958]; % filter denominator
G = tf(num,den,Ts) % LTI object in TF form
figure
ucircle,axis equal,hold on % make pole-zero plot
pzmap(G),hold off % pole-zero plot
axis([-1.2 1.2 -1 1])
title('Pole zero plot of the lowpass Butterworth filter for Example 6.1')
text(-0.98,0.05,'(2)')
disp('Hover cursor over the poles and zeros to find')
disp('damping ratio, overshoot, and frequency.')
disp('******>'), pause
w = logspace(-2,0,100)*pi/Ts; % freq vector ending at w = pi*Ts
figure, bode(G,w),grid % make frequency response plot
disp('Click on the frequency response curves to find')
disp('frequency response values')
disp('******>'), pause
%---- compute frequency-response magnitudes at several frequencies ----
ww = [0 0.4*pi/Ts pi/Ts];
[mag_ratio,ph] = bode(G,ww);
mag_db = 20*log10(mag_ratio);
disp('The warning is due to mag_ratio = 0 at ww = pi/Ts')
disp(' ')
disp(['At frequencies ',vec2str(ww)])
disp('filter gains are ')
disp([vec2str(mag_ratio),' magnitude ratio'])
disp([vec2str(mag_db),' dB'])
%%%%%%%%%%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -