def ft_approx(x,t,Nfft):
fs = <NUM_LIT:1>/(t[<NUM_LIT:1>] - t[<NUM_LIT:0>])<EOL>t0 = (t[-<NUM_LIT:1>]+t[<NUM_LIT:0>])/<NUM_LIT:2> <EOL>N0 = len(t)/<NUM_LIT:2> <EOL>f = np.arange(-<NUM_LIT:1.>/<NUM_LIT:2>,<NUM_LIT:1.>/<NUM_LIT:2>,<NUM_LIT:1.>/Nfft)<EOL>w, X = signal.freqz(x,<NUM_LIT:1>,<NUM_LIT:2>*np.pi*f)<EOL>X /= fs <EOL>X *= np.exp(-<NUM_LIT>*<NUM_LIT:2>*np.pi*f*fs*t0)<EOL>X *= np.exp(<NUM_LIT>*<NUM_LIT:2>*np.pi*f*N0)<EOL>F = f*fs<EOL>return F, X<EOL>
Approximate the Fourier transform of a finite duration signal using scipy.signal.freqz()

Parameters
----------
x : input signal array
t : time array used to create x(t)
Nfft : the number of frdquency domain points used to 
       approximate X(f) on the interval [fs/2,fs/2], where
       fs = 1/Dt. Dt being the time spacing in array t

Returns
-------
f : frequency axis array in Hz
X : the Fourier transform approximation (complex)

Notes
-----
The output time axis starts at the sum of the starting values in x1 and x2 
and ends at the sum of the two ending values in x1 and x2. The default 
extents of ('f','f') are used for signals that are active (have support) 
on or within n1 and n2 respectively. A right-sided signal such as 
:math:`a^n*u[n]` is semi-infinite, so it has extent 'r' and the
convolution output will be truncated to display only the valid results.

Examples
--------
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> import sk_dsp_comm.sigsys as ss
>>> fs = 100 # sampling rate in Hz
>>> tau = 1
>>> t = np.arange(-5,5,1/fs)
>>> x0 = ss.rect(t-.5,tau)
>>> plt.figure(figsize=(6,5))
>>> plt.plot(t,x0)
>>> plt.grid()
>>> plt.ylim([-0.1,1.1])
>>> plt.xlim([-2,2])
>>> plt.title(r'Exact Waveform')
>>> plt.xlabel(r'Time (s)')
>>> plt.ylabel(r'$x_0(t)$')
>>> plt.show()

>>> # FT Exact Plot
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> import sk_dsp_comm.sigsys as ss
>>> fs = 100 # sampling rate in Hz
>>> tau = 1
>>> t = np.arange(-5,5,1/fs)
>>> x0 = ss.rect(t-.5,tau)
>>> fe = np.arange(-10,10,.01)
>>> X0e = tau*np.sinc(fe*tau)
>>> plt.plot(fe,abs(X0e))
>>> #plot(f,angle(X0))
>>> plt.grid()
>>> plt.xlim([-10,10])
>>> plt.title(r'Exact (Theory) Spectrum Magnitude')
>>> plt.xlabel(r'Frequency (Hz)')
>>> plt.ylabel(r'$|X_0e(f)|$')
>>> plt.show()

>>> # FT Approximation Plot
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> import sk_dsp_comm.sigsys as ss
>>> fs = 100 # sampling rate in Hz
>>> tau = 1
>>> t = np.arange(-5,5,1/fs)
>>> x0 = ss.rect(t-.5,tau)
>>> f,X0 = ss.ft_approx(x0,t,4096)
>>> plt.plot(f,abs(X0))
>>> #plt.plot(f,angle(X0))
>>> plt.grid()
>>> plt.xlim([-10,10])
>>> plt.title(r'Approximation Spectrum Magnitude')
>>> plt.xlabel(r'Frequency (Hz)')
>>> plt.ylabel(r'$|X_0(f)|$');
>>> plt.tight_layout()
>>> plt.show()