给定激励,求零输入响应、零状态响应,全响应

%z_filter_imp.m
%Z域表示的数字滤波器的响应举例
%H(Z)={Z^2 + 2Z + 1}/{Z^3 -0.5Z^2 -0.005Z^-1 +0.3}
%初始状态 y(-1)= 1, y(0) = -1.
clc;
clear;
close all;

b=[0  1  2  1  0];            %分子系数
a=[1  -0.5  0  0.3  -0.005];  %分母系数

figure;
freqz(b,a,8);

figure;
subplot(421);
zplane(b,a);                  %绘制零极点图
title('系统的零极点图');

subplot(422);
impz(b,a,21);
title('单位脉冲响应');

subplot(423);
stepz(b,a,21);
title('单位阶跃响应');

%给定激励,求零输入响应、零状态响应,全响应
N=21;
n=0:N-1;
x=exp(-0.6*n);          %激励信号:指数衰减信号
x0=zeros(1,N);          %全零:零状态响应时作为全零状态
y0=[1,-1];              %初始状态(条件)
xi=filtic(b,a,y0);      %求零输入响应时的等效初始条件
y1=filter(b,a,x0,xi);   %求零输入响应

xi0=filtic(b,a,0);      %求零状态响应的等效初始条件
y2=filter(b,a,x,xi0);   %零状态响应
y3=filter(b,a,x,xi);    %完全响应
[h w]=freqz(b,a,21);    %由Z域传递函数求频率响应函数(21个点)

subplot(424);
stem(n,y1);
 title('零输入响应');
grid on;
 subplot(425);
stem(n,y2);
 title('零状态响应');
grid on;
 subplot(426);
stem(n,y3);
 title('系统的全响应');
grid on;

%绘制频率响应曲线
subplot(427);
plot(w,abs(h));
title('幅频特性曲线');
grid on;
subplot(428);
plot(w,angle(h));
title('相频特性曲线');
grid on

猜你喜欢

转载自blog.csdn.net/ccsss22/article/details/113878554