fre_response.m

来自「经典《信号与系统》教程的matlab例程,对深入理解信号与系统相关概念有很大帮助」· M 代码 · 共 26 行

M
26
字号
% Name: frequs.m
% ===============================================================
clear,close all
num=input('Input the numerator polynomial coefficient vector =:');
den=input('Input the denominator polynomial coefficient vector =:');
reg=input('Input the frequency region w=');
w=-3*reg:0.01*reg:3*reg;

[h,w]=freqs(num,den,w);
r=real(h);
i=imag(h);

subplot(2,1,1)
plot(w,abs(h));
grid on;title('magnitude response');

subplot(2,1,2)
plot(w,(180/pi)*atan(i./(r+eps)));grid on;
xlabel('frequency radians/s ');title('phase response');
figure(2)
subplot(221)
impulse(num,den)

subplot(222)
step(num,den)

⌨️ 快捷键说明

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