Birla Institute of Technology & Science, Pilani EEE G613: Advanced Digital Signal Processing Semester I: 2021-2022

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE, PILANI

EEE G613: Advanced Digital Signal Processing


Semester I: 2021-2022
Lab 2: Signal Generation and Representation
Name- parul
Id- P2021PHXP0026
Instructions: Please make sure you add a title, axis labels, x-axis limit and y-axis limit,
and legend (if required) to each of your figures.
You need to save the MATLAB code and the figure in a TIFF format.

1a) Generate a signal with total duration of 5 ms (0 to 5 ms), in which the first 3 ms
(i.e., 0 to 3 ms) there is a cosine signal , where
A (signal amplitude) = 5volts, and the last 2 ms of the total duration, the signal is zero. Use the
sampling frequency (Fs) = 800 kHz and the frequency ( of the signal is 1123 Hz.

1b) Now, a new signal is generated, where


is the same as in 1a) and the constant (in ms) = 3.

Plot the signals and as a function of time. Show the


results as subplots of 3x1.

2) An input signal is a combination of two cosine signals. The first cosine signal [e.g.,
] has a frequency of 723 Hz whereas the second cosine signal [e.g., ] contains a
frequency of 11723Hz. Note that the individual cosine signal generation has amplitude = 2,
duration = 2 seconds and sampling frequency (Fs) = 20kHz).

Sketch the magnitude spectrum of the input signal. Make sure your x-axis is in frequency (in
Hz), ranging between 0 to 10kHz. Comment on your observations. Use “FFT” command in
MATLAB. Use two different N-point FFT: (a) 1024, (b) Fs.

Answers:
1.a)
Fs = 800000;

dt = 1/Fs;
StopTime = 0.5;
b=3;
t = (0:dt:0.003);
%%Sine wave:
Fc = 1123; % hertz
x = 5*cos(2*pi*Fc*t);
% Plot the signal versus time:
plot(t,x);
xlabel('time');
ylabel('amplitude');
title('Signal versus Time');
hold on
t1 = (0.003:dt:0.005);
x1=0;
plot(t1,x1);

1.b
Fs = 800000;
dt = 1/Fs;
StopTime = 0.5;
b=3;
t = (0:dt:0.003);
%%Sine wave:
Fc = 1123; % hertz
x = 5*cos(2*pi*Fc*t);
% Plot the signal versus time:
subplot(3,1,1);
plot(t,x);
xlabel('time');
ylabel('amplitude');
title('Signal versus Time');
hold on
t1 = (0.003:dt:0.005);
x1=0;
plot(t1,x1);
subplot(3,1,2);
y = 5*cos(2*pi*Fc*(t+b));
plot(t,y);
xlabel('time');
ylabel('amplitude');
title('x(t+b)');
subplot(3,1,3);
z=5*cos(2*pi*Fc*((-t/2)+b));
plot(t,z);
xlabel('time');
ylabel('amplitude');
title('x(-t/2)+b)');

2
Fs = 20000;
dt = 1/Fs;
StopTime =0.02;
t = (0:dt:StopTime-dt);
%%Sine wave:
Fc = 723;
Fc1 = 11723;
x = 2*cos(2*pi*Fc*t);
x1 = 2*cos(2*pi*Fc1*t);
y=x+x1;
% Plot the signal versus time:
plot(t,y);
xlabel('time');
ylabel('amplitude');
title('Signal versus Time');
Signal versus Time

0 0.002 0.004 0.006 0.00B 0.01 0.012 0.014 0.016 0.01B 0.02
time

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