⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cp5_3.m

📁 离散控制系统设计的MATLAB 代码
💻 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 + -