Wednesday, September 15, 2010

Know IPython

Just like any other programming language IPython also can be used for general calculations and computations.Apart from these IPython can also be used for Signal Processing.
Most of the institutions use MATLAB for this.As the software belongs to a private firm looking for income from the software MATLAB is not affordable.But IPython is

* free as beer,
* free as speech &
*exceptionally stable

=>If you want a copy IPython please use our Downloads page

Examples:

Fast Fourier Transform(FFT)

We can compute & observe the FFT of y by the following code


from scipy import *
from numpy import *
from matplotlib import *
from pylab import *
x=range(1,100)
y=sin(x)
z=fft(y)
stem(x,abs(z),"r")
grid("True")
show()

It will return the stem plot of spectrum of a random sine wave.

Amplitude Modulation
The amplitude modulation can be shown as

from scipy import *
from numpy import *
from matplotlib import *
from pylab import *
t=r_[0:1:0.001]
mod=cos(2*pi*80*t)
carr=cos(2*pi*800*t)
am=carr*mod +carr
pylab.figure(1)
plot(t,am)
grid("True")
title("Amplitude Modulation")
xlabel("Time")
ylabel("Voltage")
pylab.figure(2)
subplot(211)
plot(range(0,len(am)),fft(am))
grid("True")
xlabel("Time")
ylabel("Voltage")
subplot(212)
plot(range(0,len(carr)),fft(carr))
grid("True")
title("Amplitude Modulation")
xlabel("Time")
ylabel("Voltage")
show()

No comments:

Post a Comment