0% found this document useful (0 votes)
113 views2 pages

Activity in Difference Equation

An LTI discrete system can be described by a linear constant coefficient difference equation. Solving such an equation provides the system's output given its input and previous outputs. The impulse response and step response can be computed using functions like filter() and impz(). Sample exercises demonstrate solving difference equations for given inputs to find the system output, and computing and plotting the impulse response and step response.

Uploaded by

Shawn Gonzales
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
113 views2 pages

Activity in Difference Equation

An LTI discrete system can be described by a linear constant coefficient difference equation. Solving such an equation provides the system's output given its input and previous outputs. The impulse response and step response can be computed using functions like filter() and impz(). Sample exercises demonstrate solving difference equations for given inputs to find the system output, and computing and plotting the impulse response and step response.

Uploaded by

Shawn Gonzales
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

ADNU ECEM324 SIGNALS, SPECTRA AND SIGNAL PROCESSING (LAB)

ACTIVITY #7 SOLVING DIFFERENCE EQUATION and IMPULSE RESPONSE


An LTI discrete system can also be described by a linear constant coefficient
difference equation of the form
N

k)
ak y(n=

=
k 0=
m 0

x(n m),

(1)

N
eU
Cp
E

If aN 0 ,then the difference equation is of order N. This equation describes a


recursive approach for computing the current output, given the input values and
previously computed output values. In practice this equation is computed
forward in time, from n = to n = .Therefore another form of this equation is

y ( n)
=

m x ( n m) ak y ( n k )

=
m 0=
k 1

Solving the Difference Equation:

AD

A function called filter is available to solve difference equations


numerically, given the input and the difference equation coefficients. In its
simplest form this function is invoked by
y = filter(b,a,x)
where
b = [b0, b1, ..., bM]; a = [a0, a1, ..., aN];
are the coefficient arrays from the equation given in (2.21), and x is the
input sequence array. The output y has the same length as input x. One must
ensure that the coefficient a0 not be zero.
A FOR loop function can also be used to solve Difference Equation

IMPULSE response of the system

To compute and plot impulse response, OCTAVE provides the function impz.
When invoked by
h = impz(b,a,n);
it computes samples of the impulse response of the filter at the sample indices
given in n with numerator coefficients in b and denominator coefficients in a.
When no output arguments are given, the impz function plots the response in the
current figure window using the stem function.

SAMPLE EXERCISES 1

Ec

Solve the following difference equation for 0 n 10 :

y (n)= y (n 1) + 2 y (n 2) + x(n 2)

given that
=
x(n) 4 cos( n=
8), y (0) 1=
and y (1) 1.

nakz.713@gmail.com

Solution:

N
eU
Cp
E

y=[1 1];
x(1)=4;
x(2)=4*cos(pi/8);
for n = 3:11
n1= n-1
x(n) = 4*cos(pi*n1/8);
y(n) = y(n-1) + 2*y(n-2) + x(n-2);
end;
stem(y);
xlabel(n);
ylabel(y(n));
title(system output y(n));

SAMPLE EXERCISES 2

Given the following difference equation:

y (n) y (n 1) + 0.9 y (n =
1) x(n); n

AD

a. Calculate and plot the impulse response h(n) at n = 20, . . . , 100.


b. Calculate and plot the unit step response s(n) at n = 20, . . . , 100.
SOLUTION:

From the given difference equation the coefficient arrays are:


b = [1]; a=[1, -1, 0.9];
Octave Script for a.
>> b = [1]; a = [1, -1, 0.9]; n = [-20:120];
>> h = impz(b,a,n);
>> subplot(2,1,1); stem(n,h);
>> title(Impulse Response); xlabel(n); ylabel(h(n))

Octave Script
>>
>>
>>

TASK 1

for b.
x = stepseq(0,-20,120); s = filter(b,a,x);
subplot(2,1,2); stem(n,s)
title(Step Response); xlabel(n); ylabel(s(n))

A linear and time-invariant system is described by the difference equation:

Ec

y ( n) =
0.5 y (n 1) + 0.25 y (n 2) =x(n) + 2 x(n 1) + x(n 3)

a. Using the filter function, compute and plot the impulse and step response
of the system over 0 n 100 .
b. If the input to this system is x(n) =
[5 + 3cos(0.2 n) + 4sin(0.6 n)] u (n) ,

determine the response y (n) over 0 n 200 using the filter function.

nakz.713@gmail.com

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy