In: Electrical Engineering
a) Calculate and plot the DTFT of ?[?] = sin( (?/ 4)?) / ?? * cos ( ?/2 ?) by hand.
b) By using a 2x1 subplot, plot ?[?] signal defined in Question 1 in the first row. Take ? between -100 s and 100 s and limit x-axis between -20 sand 20 s. Be careful about when ? = 0. What is the value of ?[0]? While plotting ?[?] please write an if statement for ? = 0. After that, write a MATLAB code that calculates and plots the DTFT of ?[?]. Then, plot the DTFT of ?[?] in the second row of the subplot. Take 1000 equally spaced frequency values between -2π and 2π by using linspace. Do not forget axis labels.
MATLAB CODE
clc;
w = -2*pi:0.0001:2*pi; % W Axis
n = -100:1:100; % Time axis
x = input('Enter signal in Discrete form : '); % Signal
x[n]
temp = w' * n;
temp = -i * temp; % (-jwn)
e = exp(temp);
X = e * x';
subplot(2,1,1); plot(n, x);
xlabel('sec');
xlim([-20 20]);
title('Sinal in Time Domain');
subplot(2,1,2);
plot(w, abs(X));
xlabel('n');
title('DTFT');
Enter signal in Discrete form :
sin(pi.*n/4)/(pi*n).*cos(pi*n/2)
>>
Note : After changing abs(X) to X