CHAPTER01:SIGNALS AND SPECTRA

Example E09 : Pg 1.13

In [1]:
# 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
fourier transform of x(t)= [ 1.58195029+0.j          1.33722176-0.38516024j  1.02105993-0.4033185j
  0.84862839-0.29364174j  0.76732853-0.17191927j  0.73478625-0.05628763j
  0.73478625+0.05628763j  0.76732853+0.17191927j  0.84862839+0.29364174j
  1.02105993+0.4033185j   1.33722176+0.38516024j]

Example E10 : Pg 1.14

In [2]:
# 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
fourier transform of x(t)= [ 34846.35579562    +0.j          20193.20071216+23060.75353691j
   1262.96607876+24147.94540875j  -9061.39666752+17581.25336274j
 -13929.23742795+10293.34682733j -15877.71059326 +3370.11697016j
 -15877.71059326 -3370.11697016j -13929.23742795-10293.34682733j
  -9061.39666752-17581.25336274j   1262.96607876-24147.94540875j
  20193.20071216-23060.75353691j]

Example E11 : Pg 1.14

In [1]:
# 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
Fourier transform of x(t)= [ 1.+0.j]
Fourier transform of x(t)= [ 1.+0.j]
Fourier transform of x(t)= [ 1.+0.j]