Contents
b = [1 2 1]; a = [1 -1.4 .74];
State-space representation (MATLAB)
[A,B,C,D]= tf2ss(b,a);
Filtering
x = [1 zeros(1,50)];
S = [0;0];
y = zeros(size(x));
for n=1:length(x)
y(n) = C*S + D*x(n);
S = A*S + B*x(n);
end
Graphics - Impulse response
FIG = figure('Name','lab1_3 : Impulse response',...
'NumberTitle','off','Units','normalized','Position',[.3 .5 .4 .32]);
stem(0:length(x)-1,y/max(abs(y)),'filled'), axis([0 50 -.5 1]); grid;
xlabel('n \rightarrow'), ylabel('h[n] / MAX \rightarrow')
text(.82*50,.86,['MAX = ',num2str(max(abs(y)))])
title('Impulse response')