Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

LAB TASK - I

ECE 2006 - DIGITAL SIGNAL PROCESSING


Faculty:Dr. Ashish P.
MARKS: 12
Name- Harsh Mishra
Registration Number-17BEC0599

Q1. COMPOSITE SINE WAVE AND SPECTRUM?


A.) Generate a composite sinusoidal wave containing 3 component frequencies:
10Hz, 20Hz and 30Hz. Consider the sampling frequency as 100Hz. Give its time
domain and frequency domain graphs.
Sol 1A)
Aim- To generate a composite sinusoidal wave containing 3 component
frequencies with spectrum :
Matlab code:
clc
clear all
f=100;
t=0:1/f:1;
c=4*sin(2*pi*10*t)+sin(2*pi*20*t)+sin(2*pi*30*t);

subplot(3,1,1);
plot(t,c);
n=256;
w=0:f/n:(f-(f/n));
c=fft(c,n);
subplot(3,1,2)
plot(w,abs(c));
subplot(3,1,3);
plot(w,angle(c));
Output:

1 B.) In place of 30Hz, give (i) 70Hz signal. Analyse how does it reflect in the
spectrum. (ii) What happens if an 80Hz signal is given instead of 30Hz signal.
Sol: -
MATLAB CODE: -
clc
clear all
f = 100;
t = 0:1/f:1;
x = sin(2*pi*10*t)+sin(2*pi*20*t)+sin(2*pi*70*t); plot(t,x);
N=256;
W=0:f/N:(f-(f/N));
X=fft(x,N); plot(W,abs(X));
Output:

Q2. SYNTHESIS OF SQUARE WAVE USING FOURIER SERIES


EXPANSION
It is known that an odd square wave is given by the Fourier series expansion as
follows
𝑥(𝑡) = ∑ 4 𝑛𝜋 sin( 2𝜋𝑛𝑡 𝑇𝑜 ) ∞ 𝑛=1,3,5
Generate the above square wave in MATLAB. Consider 𝑇𝑜 = 1. Note: The
submission should contain the description of the problem, MATLAB code and
graphs.

Matlab code:
clc
clear all
f=100;
t=0:1/f:1;
t0=1;
c=0;
for n=1:2:100
c=c+ (4/n*pi)*sin(2*pi*n*t/t0);
end
subplot(3,1,1);
plot(t,c);
n=256;
w=0:f/n:(f-(f/n));
c=fft(c,n);
subplot(3,1,2)
plot(w,abs(c));
subplot(3,1,3);
plot(w,angle(c));

Output:

You might also like