0% found this document useful (0 votes)
54 views3 pages

Program Coding

This MATLAB code simulates the time and frequency response of a linear time-invariant (LTI) system. It generates input and output signals in the time domain, plots them, and calculates the magnitude and phase responses in the frequency domain, plotting those as well. The time response plot shows the input sinusoid and output filtered signal. The frequency response plot shows the magnitude and unwrapped phase of the system's transfer function.

Uploaded by

s.reegan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views3 pages

Program Coding

This MATLAB code simulates the time and frequency response of a linear time-invariant (LTI) system. It generates input and output signals in the time domain, plots them, and calculates the magnitude and phase responses in the frequency domain, plotting those as well. The time response plot shows the input sinusoid and output filtered signal. The frequency response plot shows the magnitude and unwrapped phase of the system's transfer function.

Uploaded by

s.reegan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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 07ece52');
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 07ece52');
OUTPUT:

time response of a system 07ece52


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 07ece52
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-->

You might also like