# Page Number: 1.13
# Example 1.9
# Given,
# Signal is x(t)= e^(-at) * u(t)
# unity function u(t)=1 for 0 to infinity
# therefore
import math,numpy
x=1;
# We assume 'infinity' value as 10 and the value of 'a' is 1
#t= 0:1:10;
t=numpy.linspace(0,10,num=11)
a=1;# a >0
z=((math.e)**(-a*t) * x);
y=numpy.fft.fft(z);
print 'fourier transform of x(t)=',y
# Page Number: 1.14
# Example 1.10
# Given,
# Signal is x(t)= e**|-a|t * u(t)
# unity function u(t)=1 for 0 to infinity
# therefore
import numpy,math
x=1;
# We assume 'infinity' value as 10 and the value of 'a' is 1
t= numpy.linspace(0,10,num=11);
a1=1;# For a >0
a2=-1; # For a <0
z=((math.e)**(a2*t) * x)+((math.e)**(a1*t) * x);
y=numpy.fft.fft(z);
print'fourier transform of x(t)=',y
# Page Number: 1.14
# Example 1.11
# (a)
# Given
# Signal is x(t) = rect(t)
# rect(t) = 1 for -a< |t| < a and 0 elsewhere
# Therefore
# We find out fourier transform of x(t)= 1 for -a< |t| < a thus,
import math,numpy
x=([1]);
a= 200; # Assume
t= numpy.linspace(-a,a,num=2*a+1); # range for fourier transform
y=numpy.fft.fft(x);
print'Fourier transform of x(t)=',y
# (b)
# Given
# Signal is x(t) = rect(t)
# rect(t) = 1 for -a/4< |t| < a/4 and 0 elsewhere
# Therefore
# We find out fourier transform of x(t)= 1 for -a/4< |t| < a/4 thus,
x=([1]);
a= 200; # Assume
t= numpy.linspace(-a/4,a/4,num=(a/2)+1);# range for fourer transform
y=numpy.fft.fft(x);
print'Fourier transform of x(t)=',y
# (c)
# Given
# Signal is x(t) = rect(t)
# rect(t) = 1 for b < |t| < b + a/2 and 0 elsewhere
# Therefore
# We find out fourier transform of x(t)= 1 for b < |t| < b+ a/2 thus,
x=([1]);
a= 200; # Assume
b=100; # Assume
t=numpy.linspace(b,(b+(a/2)),num=((a/2)+1)) ;# range for fourer transform
y=numpy.fft.fft(x);
print'Fourier transform of x(t)=',y