0% found this document useful (0 votes)
147 views13 pages

DSP Lab Report-2 by L Govind Ec

This document provides a summary of key digital signal processing concepts such as aliasing, impulse signals, even/odd signals, linear/circular convolution, causal/non-causal systems, and system stability. It also includes MATLAB code to generate and sample sinusoids to demonstrate aliasing, perform linear convolution, and analyze stability conditions for the system h(n)=anu(n).

Uploaded by

Govind Reddy
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 PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
147 views13 pages

DSP Lab Report-2 by L Govind Ec

This document provides a summary of key digital signal processing concepts such as aliasing, impulse signals, even/odd signals, linear/circular convolution, causal/non-causal systems, and system stability. It also includes MATLAB code to generate and sample sinusoids to demonstrate aliasing, perform linear convolution, and analyze stability conditions for the system h(n)=anu(n).

Uploaded by

Govind Reddy
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 PDF, TXT or read online on Scribd
You are on page 1/ 13

DSP LAB REPORT-2

1 | P a g e
NIT CALICUT

DSP LAB REPORT-2



DEPARTMENT OF ELECTRONICS ENGINEERING
NATIONAL INSTITUTE OF TECHNOLOGY CALICUT
NIT CAMPUS PO, CALICUT
KERALA, INDIA 673601





By
L Govind Reddy (M110117EC)



DSP LAB REPORT-2
2 | P a g e
NIT CALICUT
1 Background reading:
1.1 Aliasing?
Aliasing:
In case of sampling frequency fs < 2fm (where fs is sampling frequency, fm is maximum
frequency of input signal), we cannot reconstruct the original signal fully from the sampled
signal there will be a definite loss of original signal.
The loss of information in such case is due to super position of high frequency
component with low frequency component. This phenomenon is called aliasing.

1.2 Impulse input, unit step input, etc..?
Unit Impulse Signal:
1. A unit impulse signal (o( t) ) is function which is having unit area over a infinite time
interval. Unit impulse function (o( t) ) is define as

o( t) = 0 when t 0
1 when t = 0


Some properties of unit impulse signal:
a. o( t) Jt = 1

-

b. x( t) o( t) Jt = x( 0)

-

c. x( t) o( t t0) Jt = x( t0)

-

d. o( ot) =
1
| u|
o( t)
e. o( t) = o( t)
f. x( t) o( t) = x( 0) o( t)



DSP LAB REPORT-2
3 | P a g e
NIT CALICUT
2. A unit impulse sequence o( n) is defined as
o( n) = 1 when n = 0
0 when n 0

Unit step signal:
1. Continuous time unit step signal u(t), is defined as
u(t) = 1 when t > 0
= 0 when t < 0

2. Discrete time unit step signal u(n), is defined as
u(n) = 1 when n 0
0 when n < 0




DSP LAB REPORT-2
4 | P a g e
NIT CALICUT
Unit Ramp signal:
1. A continuous time unit ramp signal r(t) is defined as
r(t) = t when t > 0
= 0 when t < 0







2. A discrete time unit ramp signal r(n) is defined as
r(n) = n when n 0
= 0 when n < 0

1.3 Even and odd signals?
Even signal:
A signal x( t) is said to be even signal if
x( t) = x( t)
Example:
x( t) = t
2



DSP LAB REPORT-2
5 | P a g e
NIT CALICUT
Odd signal:
A signal x( t) is said to be odd signal if
x( t) = x( t)
Example:
x( t) = si n ( t)
1.4 Linear convolution. Circular convolution?
Linear convolution:
1. Linear convolution of two signals x( t) and ( t) is defined as
y( t) = x( t) ( t) = x( ) ( t ) J

-

The output of any Linear Time Invariant system is the convolution of input signal with
the impulse response of the system.
2. Linear convolution of two sequences x( n) and ( n) is defined as
y( n) = x( n) ( n) = x( k) ( n k)

k=-

The output of any Discrete Time Invariant system is the convolution of input signal with
the impulse response of the system.
Circular convolution:
The circular convolution of two sequences x( n) and ( n) is defined as
y( n) = x( n) ( n) = x( n) [ ( n m)
N-1
m=0
N]
.
Circular convolution is defined for finite length sequences (usually equal length sequences)
1.5 Causal versus non-causal systems?
Causal system:
A system is said to be causal if the output y( t) of the system at any time t = t
0
depends on
the input x( t) for t t
0

I.e. the output of the system depends on present and/or past values of the input not on
future values of the input
Example:
y( t) = x( t 2)
Non Causal system:
A system is said to be non-causal if its output depends on future values of the input.
Example:
y( t) = x( t + 3)
N
DSP LAB REPORT-2
6 | P a g e
NIT CALICUT

1.6 System stability?
Stable system:
A system is said to be stable if for any bounded value of input the output of system
should be bounded.
Example:
y( t) = c
-3t
u( t)

2 Implement
2.1 Generate two sinusoids with frequencies F0 = 1/8Hz and F1 = 7/8Hz. Sample both at Fs
= 1Hz. Generate stem plots for each, with a different color for each. Plot the original
continuous signals over the sampled one, again each color coded. What do you
observe? Determine the sampling rate at which you can avoid a problem here? Repeat
the procedure at this new sampling frequency. What do you observe?
Program:
%sampling both with frequency 1 Hz
clc;
clear all;
f1=1/8;
f2=-7/8;

t1=0:.25:80/7;
t2=0:.05:80/7;
N1=0:1/1:80/7;
N2=0:1/1:80/7;
y1=sin(2*pi*f1*N1);
y2=sin(2*pi*f2*N2);
y1c=sin(2*pi*f1*t1);
y2c=sin(2*pi*f2*t2);

stem(N1,y1,'red');

hold on;

plot(t1,y1c,'green');

hold on;
stem(N2,y2,'black');
hold on;

plot(t2,y2c,'blue');
hold on;



DSP LAB REPORT-2
7 | P a g e
NIT CALICUT
Output:


Observation:
Here the problem is, signal one is completely reconstructed from its samples since
its frequency f
1
is 1/8 and sampling frequency f
s
is 1 i.e. nearly 8 times signal frequency.
But for the signal we cannot reconstruct the full signal from the sampled one because signal
frequency f
2
is 7/8 and sampling frequency f
s
is 1 which is less than the 2f
2
.
So to avoid that problem we should take the sampling frequency at least twice the
frequency of second signal (=1.75 Hz).
Here in next program fs is taken as 3.5 Hz which equal to the four times of the second
signal frequency


Program:
%sampling frequency fs=3.5 Hz
clc;
clear all;
f1=1/8;
f2=-7/8;

t1=0:.25:80/7;
DSP LAB REPORT-2
8 | P a g e
NIT CALICUT
t2=0:.05:80/7;
N1=0:1/1:80/7;
N2=0:1/1.1:80/7;
y1=sin(2*pi*f1*N1);
y2=sin(2*pi*f2*N2);
y1c=sin(2*pi*f1*t1);
y2c=sin(2*pi*f2*t2);

stem(N1,y1,'red');

hold on;

plot(t1,y1c,'green');

hold on;
stem(N2,y2,'black');
hold on;

plot(t2,y2c,'blue');
hold on;

Output:


Here both signals can be reconstructed from there sampled ones.

DSP LAB REPORT-2
9 | P a g e
NIT CALICUT
2.2 Plot signal x (n) = [1 1 1 0 1 2 3 4], where x (0) = 0; Plot x (-n) and x (-n + 2). Obtain
linear convolution with system h (n) = [1 2 1 -1], h (0) = 2; Show the output.
Program:
clc;
clear all;
close all;
%x=[1 1 1 0 1 2 3 4];
%h=[1 2 1 -1 ];
x=input('enter x');
h=input('enter y');
[p q]=size(x);
[r s]=size(h);
p1=input('enter the indux range of x');
r1=input('enter the indux range of y');
%ploting x(n),x(-n),x(-n+2)
n=p1(1):1:p1(2);
subplot(2,2,1);
stem(n,x);
title('x(n)');
subplot(2,2,2);
stem(-n,x);
title('x(-n)');
subplot(2,2,3);
stem(-n+2,x);
title('x(-n+2)');

%convolution....
for m=1:s+q-1
if m<=s
y(m)=x*[fliplr(h(1:m))';zeros(q-m,1)];

elseif m>s && m<=q
y(m)=x*[zeros(m-s,1);fliplr(h)';zeros(q-m,1)];
else
y(m)=x*[zeros(m-s,1);fliplr(h(m-(q-1):s))'];
end
end


subplot(2,2,4);
n2=p1(1)+r1(1):1:p1(2)+r1(2);
stem(n2,y);
title('convolution');



DSP LAB REPORT-2
10 | P a g e
NIT CALICUT
Giving inputs to above function through command prompt:
Command window:
enter x[1 1 1 0 1 2 3 4]
enter y[1 2 1 -1]
enter range of x[-3 4] %since x(0)=0
enter range of y[-1 2] %since h(0)=2
Output:











DSP LAB REPORT-2
11 | P a g e
NIT CALICUT
2.3 Show stable and unstable conditions for the linear time invariant system h(n) = a
n
u(n).
Program:
clc;
clear all;
close all;
a1=2;
a2=.5;

%n will have only positve values because y(n)=a^n u(n),u(n)=0
for n<0
n=0:1:50;
y1=a1.^n;
y2=a2.^n;
subplot(2,1,1);
plot(n,y1);
title('plot for a>=1')
subplot(2,1,2);
plot(n,y2);
title('stable system0<a<1')

Output:


Stability condition:
y(n) is unstable when a 1,and stable when 0 < a < 1.
DSP LAB REPORT-2
12 | P a g e
NIT CALICUT
3 Results and discussion
3.1 Discuss sampling problem in implement 1. Can you give a theoretical explanation for
the particular frequencies that come up? Would you be able to give a F2 for which this
same sampling problem would occur at Fs?
The problem encountered in program one is with sampling frequency f
s
(1 Hz), f
s
is
greater than the 2f
1
(2*1/8 = 0.25 Hz) but it is not greater than 2f
2
(2*7/8 = 1.75 Hz)so we
cannot reconstruct the second signal from its sampled sequence.
For f
s
= 1 Hz any signal which is having frequency greater than 0.5 Hz will face the same
problem during reconstructing original signal from the sampled sequence because fs should
be at least twice the signal frequency(from nyquist theorem).
3.2 How would the result in implement 2 change if we were to change the origin point of
(a) x (n)
(b) h (n)
1. For problem 2 initially
(Value indicated in bold is origin)
x(n) = [1 1 1 0 1 2 3 4]
h(n) = [1 2 1 -1]
And x(0) = 0 i.e. the index range of x is -3 to 4, h(0) = 2 i.e. index range of h is -1 to 2.
The convolution of x(n) and h(n) is

y(n) = [ 1 3 4 2 1 3 8 11 9 1 -4]

Here y(0) = 1, i.e. the index range of y is -4 to 6.

2. Now I will change the origin of x(n) and h(n)
(Value indicated in bold is origin)
x(n) = [1 1 1 0 1 2 3 4]
h(n) = [1 2 1 -1]
Here x(0) = 1 i.e. the index range of x is -4 to 3, h(0) = 1 i.e. index range of h is -2 to 1.
The convolution of x(n) and h(n) is

y(n) = [ 1 3 4 2 1 3 8 11 9 1 -4]

Here y(0) = 8, i.e. the index range of y is -6 to 4.
So if we change the origin of any sequence same values will repeat with different
indexes.
3.3 How would the stability condition change if we were dealing with the system
h(n) = a
n
n

0
= b
n
n < 0
1. If n

0 then
h(n) = a
n
is stable if 0 < a <1 and h(n) is unstable if a 1.
2. If n < 0 then
h(n) = b
n
is stable if b > 1 and h(n) is unstable if 0 < b 1.

DSP LAB REPORT-2
13 | P a g e
NIT CALICUT

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