0% found this document useful (0 votes)
17 views6 pages

Dsap Lab 3

This is the practice lab for Digital signal analysis and processing

Uploaded by

lartzyjames
Copyright
© © All Rights Reserved
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)
17 views6 pages

Dsap Lab 3

This is the practice lab for Digital signal analysis and processing

Uploaded by

lartzyjames
Copyright
© © All Rights Reserved
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/ 6

TITLE: OUTPUT OF LTI SYSTEM AND MAGNITUDE AND

PHASE RESPONSE OF INFINITE IMPULSE RESPONSE


(IIR) SYSTEM
THEORY:
Linearly time-invariant (LTI) systems are a class of systems used in signals and systems.
They possess the desirable properties of linearity and time invariance, making them
effective for modeling various real-world systems such as circuits and plants (power
electronics) consisting of inductors, transistors, and resistors.
Linearity refers to the property of a system that satisfies both superposition and scaling
properties. If we have two input signals, x1(t) and x2(t), and their corresponding outputs
y1(t) and y2(t), a linear system will exhibit the following behavior: when an input signal
x3(t) = a * x1(t) + b * x2(t) is applied, the corresponding output y3(t) will be equal to
a * y1(t) + b * y2(t).
Time invariance refers to the property of a system where a time shift in the input signal
results in an identical time shift in the output signal. For example, if the output of the
system is y[n] = x[n], delaying the output by n0 would result in y[n] = x[n - n0].
Similarly, if the input is delayed, x[n] = x[n - n0], the output y[n - n0] will be equal to x[n
- n0]. This property demonstrates that the system's behavior remains unchanged over
time.
The impulse response is a key characteristic of LTI systems. It describes the system's
behavior when subjected to an impulse input. Typically denoted as h[n], the impulse
response is used to predict the system's output for any given input.
Convolution is a fundamental operation used to characterize LTI systems. In the discrete-
time domain, convolution sums represent signals as a linear combination of delayed input
signals. For a system with input x[n], output y[n], and impulse response h[n], the output
of the convolution is given by the equation:

y[n] = ∑ x [ k ] h[n−k ]
k=−∞

Infinite Impulse Response (IIR) filters are a type of recursive filter commonly used in
signal processing. They compute the output based on current and previous inputs and
outputs. IIR filters are designed by identifying the pulse transfer function H(z) that meets
the specified filter requirements. Their implementation often results in reduced memory
and processing demands when used in software.
The magnitude response of an IIR filter refers to its behavior concerning amplitude at
different frequencies. It describes how the filter affects the amplitude of various
frequency components in the input signal. The magnitude response is typically
represented by a frequency response curve, usually displayed on a logarithmic scale in
decibels (dB).
The phase response of an IIR filter describes the relationship between the input and
output signals in terms of phase or time delay at different frequencies. It is represented by
a phase response curve, which illustrates the phase shift introduced by the filter as a
function of frequency. The phase shift is commonly expressed in degrees or radians.
M

Y ( z)
∑ b k z−k
k=0
H(z) = X (z )
= N
1+ ∑ ak z
−k

k=1

By modifying the writing style, I aimed to provide a clearer and more concise
explanation of the concepts associated with LTI systems, linearity, time invariance,
impulse response, convolution, IIR filters, magnitude response, and phase response.
SOURCE CODE:

1. x[n] = u(n) and h[n] = 2nu(n)

clc;
clear all;
close all;
n = -2:2;
a = length(n);
x = 1;
while(x<=a)
if(n(x)>= 0)
ud(x)= 1;
h(x)=2^n(x);
else
ud(x)=0;
h(x)=0;
end
x = x+1;
end
grid on;
y = conv (ud, h);
subplot (3,1,1);
stem(n,ud);
title('x[n]=u(n)-76015')
subplot (3,1,2);
stem(n,h);
title('h[n]=2^n*u (n)-76015')
subplot (3,1,3);
stem(y);
title('Y[n]-76015');

OUTPUT:

DISCUSSION:
In the given lab session, the goal was to process an input signal x[n] and an impulse
response h[n] using a linear time-invariant (LTI) system. The following steps were
undertaken to achieve this:
The input signal x[n] and impulse response h[n] were generated by limiting their ranges
from -2 to +2. This range limitation was necessary as the original signals were infinite
series. The length of the range was stored in the variable a.
To generate the signals, a loop was implemented with a length of 5, based on the value
stored in a. Within the loop, conditions were applied to determine the values of x[n] and
h[n] at each index. The specific conditions for generating the signals were not mentioned
in the description, but they were implemented within the loop.
Once the values of x[n] and h[n] were calculated, the next step involved finding the
output of the LTI system. This was achieved by performing convolution between x[n] and
h[n] using the conv function. Convolution combines the two signals to produce the output
signal y[n].
Finally, the stem function was utilized to plot the input signal x[n], impulse response
h[n], and the output of the LTI system y[n]. However, in the description, it is mentioned
that only stem(y) was used to plot the output. This indicates that only the output signal
y[n] was plotted to observe its behavior over time, while the input signal and impulse
response were not explicitly visualized.
In summary, the lab session involved generating the input signal x[n] and impulse
response h[n], convolving them to obtain the output of the LTI system y[n], and plotting
the output signal. The specific conditions for generating x[n] and h[n] were not provided,
but the main focus was on analyzing the behavior of the output signal y[n] over time
using the stem function.

−1 −2 −3
0 .56 z +0 . 638 z + 0 . 08 z
2. H(z) = −1 −2 −3
1+ 0. 6 z +0 . 34 z −0 . 4 z

clc;
clear all;
close all;
b =[0 0.56 0.638 0.08];
a = [1 0.6 0.34 -0.4];
[H, w] = freqz (b, a, 1024, 'whole');
mag = abs(H);
phase=angle(H);
W = w/pi;
subplot(2,1,1);
plot (w, mag);
xlabel('Normalized frequency (\times\Pi)');
ylabel('Magnitude');
title('Magnitude response-76015');
subplot(2,1,2);
plot (w, phase);
xlabel('Normalized frequency (\times\Pi)');
ylabel('Phase');
title('Phase response-76015');

OUTPUT:

DISCUSSION:
During this lab, our objective was to analyze and visualize the magnitude and phase
response of an Infinite Impulse Response (IIR) filter. We were provided with the transfer
function equation, H(z), and our task was to plot the frequency response.
To begin, we examined the given transfer function equation and compared it with the
equation representing a causal IIR system. By making this comparison, we determined
the coefficients 'b' and 'a' specific to the transfer function. These coefficients were then
stored in the variables 'b' and 'a', respectively.
To calculate the frequency response of the IIR filter, we utilized the 'freqz' function. By
using the statement '[H, w] = freqz(b, a, 1024, 'whole')', we obtained the frequency
response vector 'H'. The '1024' parameter determines the number of points used to sample
the frequency range.
To derive the magnitude response, we computed the absolute values of 'H' using the 'abs'
function. Similarly, to determine the phase response, we applied the 'angle' function to
'H'.
Finally, we utilized the 'plot' function to create visual representations of the magnitude
and phase responses. These plots allow us to gain insights into how the IIR filter affects
the amplitude and phase of different frequency components.

CONCLUSION:
The lab session was a valuable learning experience in the field of signal processing. We
delved into two key concepts: convolution and Infinite Impulse Response (IIR) filters.
Convolution, the fundamental operation in linear systems, was explored in the context of
an LTI system. We grasped the significance of convolving the input signal with the
impulse response to obtain the output signal, enabling us to comprehend how the system
modifies the input over time. Employing MATLAB's conv function, we executed the
convolution process seamlessly. An important observation was made regarding the
plotting of the LTI system's output. By visualizing the complete output signal, without
restricting the range, we gained a holistic understanding of its behavior and dynamics.
Furthermore, we dived into the realm of IIR filters, recursive filters commonly used in
signal processing. The transfer function equation of an IIR filter was provided, and we
derived the numerator and denominator coefficients. We explored how to compute and
analyze the magnitude and phase response of the IIR filter using the freqz function,
allowing us to understand its frequency-dependent characteristics. This lab session
equipped us with practical knowledge and tools to investigate linear systems, design
filters, and analyze their responses in MATLAB.

You might also like