Birla Institute of Technology & Science, Pilani EEE G613: Advanced Digital Signal Processing Semester I: 2021-2022
Birla Institute of Technology & Science, Pilani EEE G613: Advanced Digital Signal Processing Semester I: 2021-2022
Birla Institute of Technology & Science, Pilani EEE G613: Advanced Digital Signal Processing Semester I: 2021-2022
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.
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