www.gusucode.com > MATLAB仿真技术与应用__的配套例题和习题的matlab源代码 > 第四章/example2.m

    %MATLAB program4-2
%Transfer, Step & Impulse response
clear all; clc;
a=[1 –0.4 0.8]; b=[1 0.7];               %输入传递函数的系数
figure(1);                            %绘制冲激响应曲线
subplot(2,1,1);
dimpulse(b,a,20);
title(‘冲激响应’);
xlabel(‘n’);
ylabel(‘h(n)’);
subplot(2,1,2);                        %绘制阶跃响应曲线
dstep(b,a,50);
title(‘阶跃响应’);
xlabel(‘n’);
ylabel(‘h(n)’);
figure(2);                            %绘制幅频特性和相频特性曲线
t=[0:1:500]*pi/500;freqz(b,a,t);