?? cp5_3.m
字號:
%%%%%%%%%%% Comprehensive Problem 5.3 %%%%%%%%%%%
% 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 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ---- Anti-aliasing filters ----
%
clear
disp('Comprehensive Problem 5.3')
dt = 0.001; % time increment
tt = [0:dt:10-dt]; % continuous time
e = 5*cos(4*pi*tt) + 2*cos(18*pi*tt); % continuous-time signal
disp('Order of anti-aliasing filter')
n = 4
Ho = tf(10*pi,[1 10*pi])
Ho = ss(Ho);
H = 1;
for i = 1:n
H = H*Ho;
end
y = lsim(H,e,tt);
figure
kk = [9001:10000];
plot(tt(kk),e(kk),'--',tt(kk),y(kk)),grid
legend('input signal','output signal')
xlabel('Time (s)')
ylabel('Amplitude')
title('Input and output signals of the lowpass filter')
disp('Plot input and output signals of the lowpass filter')
disp('*****>'), pause
% sample y at 10 Hz
k = [9001:100:10000];
yfft = fft(y(k));
figure
f = [0:1:9]';
stem(f,abs(yfft)),grid
xlabel('Frequency (Hz)')
ylabel('Magnitude of Spectrum')
title('Spectrum of output signal')
disp('Plot spectrum of output signal')
%%%%%%%%%%
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -