Labsheet1 EAC22065
Labsheet1 EAC22065
Labsheet1 EAC22065
Ex.No:1
Ex.Name: DFT and IDFT
Name of the student: Vinayakan Sajeev
Reg.No:AM.EN.U4EAC22065
Objective:
Evaluation:
19EAC283 Digital Signal Processing & Processors Lab
Ex_1: Generate 320 samples of a 50Hz sine wave sampled at 8KHz and multiply this by a1KHz
sine wave sampled at 8KHz. Plot the resulting waveform.
CODE:
t=(0:320)/8000;
x1=sin(2*pi*50*t);x2=sin(2*pi*1000*t);
subplot(3,1,1)
stem(x1)
xlabel('t')
ylabel('x(t)')
title('sine of 50hz');
subplot(3,1,2)
stem(x2)
xlabel('t')
ylabel('x(t)')
title('sine of 1khz');
fin=x1.*x2;
subplot(3,1,3)
stem(fin)
xlabel('t')
ylabel('x(t)')
title('product signal');
OUTPUT:
Ex_2: Generate and plot the signal x(t) = 3cos(20πt)−2sin(30πt) over a time range of 0 < t
< 400msec. Also plot the DT signal formed by sampling this function at the following
sampling intervals:
Based on your results, what can you say about how fast this signal should be sampled so
that it could be reconstructed from the samples?
CODE:
close all;clear all;clc
19EAC283 Digital Signal Processing & Processors Lab
t=0:1/800:0.4;
x=3*cos(20*pi*t)-2*sin(30*pi*t);
plot(t,x)
xlabel('t');
ylabel('x(t)');
title('original');
figure;
subplot(4,2,1)
t=0:1/120:0.4;
x=3*cos(20*pi*t)-2*sin(30*pi*t);
plot(t,x)
xlabel('t');
ylabel('x(t)');
title('ts=1/120')
subplot(4,2,2);
stem(t,x)
subplot(4,2,3)
t=0:1/60:0.4;
x=3*cos(20*pi*t)-2*sin(30*pi*t);
plot(t,x)
xlabel('t');
ylabel('x(t)');
title('ts=1/60')
subplot(4,2,4);
stem(t,x)
subplot(4,2,5)
t=0:1/30:0.4;
x=3*cos(20*pi*t)-2*sin(30*pi*t);
plot(t,x)
xlabel('t');
ylabel('x(t)');
title('ts=1/30')
subplot(4,2,6);
stem(t,x)
subplot(4,2,7)
t=0:1/15:0.4;
x=3*cos(20*pi*t)-2*sin(30*pi*t);
plot(t,x)
xlabel('t');
ylabel('x(t)');
title('ts=1/15')
subplot(4,2,8);
stem(t,x)
Ex_3: Sample the CT signal x(t) = sin(2πt) at a sampling rate fs. Then, using MATLAB,
plot the interpolation between samples in the time range −1 < t < 1 using the
approximation:
19EAC283 Digital Signal Processing & Processors Lab
(a) fs= 4, fc = 2, N = 2
y3(i)=y3(i)+2*(fc/fs)*sin(2*pi*n*ts)*sinc(2*fc*(t(i)-n*ts));
end
end
subplot(4,1,4);
plot(t,y3)
xlabel('t');
ylabel('x(t)');
title('fs=16,fc=8,N=4')
OUTPUT
INFERENCE: The concept of sampling of signals has been explained in the experiments. We can infer from
them about the concept of Nyqist rate and Nyquist interval, which is essesntial in sampling
a signal accurately. Differences in reconstructed signals with different sampling frequency
and number of samples can be clearly identified form the graphs plotted. We have also looked
at multiplication of signals and have visually seen from the graph how it would be. The optimal
rate at which a signal should be sampled is also understood after this experiment.
Evaluator Name: