x = zeros(1,30);
x(11:20) = 1;
Xfft = fft(x)
N = 10;
w = -pi:0.01:pi;
j = sqrt(-1);
X = (1- exp(j*w*N))./(1- exp(j*w));
figure
subplot(2,1,1)
plot(w,abs(X))
grid on
xlabel('normalized angular frequency, omega');
title('abs(DTFT values)');
ylabel('magnitude units')
subplot(2,1,2)
plot(w,-angle(X))
grid on
xlabel('normalized angular frequency, omega');
title('Phase of DTFT[rect pulse N = 10]');
ylabel('radians')