%
% This M-file is created for lectures of zero-state response 
% and linear convolution integral
%
% EE321-Linear system I 
% 
% zsrspns.m --- Zero State response and convolution
%
% @ Kefu Xue, Ph.D., April 2, 2001
%
% input signal x(t)
%
deltaT=0.01;% pick sampling intervel
xs=2;% starting time for x(t)
xe=7;% ending time for x(t)
tx=xs:deltaT:xe; 
%
x=tx; 
%
% impulse response h(t)
%
hs=3; %starting time for h(t)
he=10; %ending time for h(t)
th=hs:deltaT:he;
z1=length(th);
h=ones(1,z1);
subplot(3,1,1);plot(tx,x);title('input signal');
subplot(3,1,2);plot(th,h);title('impulse response');
y=conv(h,x)*deltaT;% convolution: suma(x(a)h(t-a)*deltaT)
ys=hs+xs;%starting time of y(t)
ye=he+xe;%ending time of y(t)
ty=ys:deltaT:ye;
subplot(3,1,3);plot(ty,y);title('Zero-state response');
pause
%
% System transfer functions
%         s^2+1
%  H(s)= ----------
%        s^3-2s+5
Bs=[1 0 1];
As=[1 0 -2 5];
echo on
Z=roots(Bs) %zeros
P=roots(As) %poles
echo off
figure;zplane(Z,P);% or you can also use zplane(Bs,As);
title('pole/zero diagram of a LTI system'); 
%
pause
close all
%


