Anda di halaman 1dari 3

PROGRAM CODING:

%TIME RESPONSE OF AN LTI SYSTEM


clc;
clear all;
close all;
figure(1);
n=0:99;
x=sin(0.05*pi*n);
num=[1 0 -1];
den=[1 -0.5 0];
y=filter(num,den,x);
subplot(2,1,1);
plot(n,x,'b');
grid on;
hold on;
plot(n,y,'--r');
hold off;
xlabel('n-->');
ylabel('magnitude-->');
title('time response of a system 07ece51');
h=legend('input','output',1);
set(h,'interpreter','none');
%FREQUENCY RESPONSE OF AN LTI SYSTEM

omega=linspace(0.1,0.99);
z=exp(j*pi*omega);
num=[1 01 -1];
den=[1 -0.5 0];
p1=polyval(num,z);
p2=polyval(den,z);
pha=angle(p1)-angle(p2);
subplot(2,1,2);
plot(omega,abs(p1./p2),'b');
grid on;
hold on;
plot(omega,unwrap(pha),'--r');
hold off;
h=legend('magnitude','phase',1);
set(h,'interpreter','none');
xlabel('normalised frequency-->');
title('frequency response of a system 07ece51');
OUTPUT:

time response of a system 07ece51


1
magn input
itude- 0.5
-> output

-0.5

-1
0 10 20 30 40 50 60 70 80 90 100
n-->
frequency response of a system 07ece51
4
magnitude
2 phase

-2

-4
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
normalised frequency-->

Anda mungkin juga menyukai