Frequency Response of a Given System with Wave Forms

By
Advertisement
%impulse response
clc;
clear all;
close all;
N=input('enter the length of the sequence');
a=input('enter the numerator coefficient value');
b=input('enter the denominator coefficient value');
n1=0:1:N-1;
x1=(n1==0);
h1=filter(b,a,x1);
disp(h1);
subplot(2,1,1);
stem(n1,x1);
title('impulse response');
xlabel('samples');
ylabel('amplitude');
subplot(2,1,2);
stem(n1,h1);
xlabel('samples');
ylabel('amplitude');
%unit step
clc;
clear all;
close all;
N=input('enter the length of the sequence');
a=input('enter the numerator coefficient value');
b=input('enter the denominator coefficient value');
n1=0:1:N-1;
x1=(n1>=0);
h1=filter(b,a,x1);
disp(h1);
subplot(2,1,1);
stem(n1,x1);
title('unit step response');
xlabel('samples');
ylabel('amplitude');
subplot(2,1,2);
stem(n1,h1);
xlabel('samples');
ylabel('amplitude');
% cosine signal
clc;
clear all;
close all;
N=input('enter the length of the sequence');
a=input('enter the numerator coefficient value');
b=input('enter the denominator coefficient value');
n1=0:1:N-1;
x1=cos(0.05*pi*n1);
h1=filter(b,a,x1);
disp(h1);
subplot(2,1,1);
stem(n1,x1);
title('cos signal');
xlabel('samples');
ylabel('amplitude');
subplot(2,1,2);
stem(n1,h1);
xlabel('samples');
ylabel('amplitude');





0 comments:

Post a Comment