You are on page 1of 1

# -*- coding: utf-8 -*"""

Created on Fri Dec 12 21:28:50 2014


@author: Anish
"""
import os
os.system('cls')
import numpy as np
N = 11
nvec = np.linspace(0, 10, num=N)
x_n = (0.5*exp(1j*pi/3))**nvec
plot(nvec,abs(x_n),label='Absolute value of Function: |x[n]|')
plt.xlabel('Time Index')
plt.ylabel('Function')
legend(bbox_to_anchor=(.9, .9), loc=1, borderaxespad=0.)
# DTFT
M = 401
w = np.linspace(-2*pi,2*pi,num = M)
x_w2 = (1-(.9*exp(-1j*(w-pi/3)))**11)/(1-exp(-1j*(w-pi/3)))
figure(2)
plt.subplot(211)
plot(w/pi,10*np.log(abs(x_w2)),label='Amplitude Spectrum')
plt.ylabel('Amplitude (dB)')
plt.subplot(212)
plot(w/pi,np.angle(x_w2),label='Phase Spectrum')
plt.xlabel('Digital Frequency (multiples of pi)')
plt.ylabel('Phase')
legend(bbox_to_anchor=(.5, .9), loc=1, borderaxespad=0.)

You might also like