pymat strange behavior

John Hunter jdhunter at ace.bsd.uchicago.edu
Tue Mar 9 18:37:11 CET 2004


>>>>> "John" == John Houston <7z6fp9202 at sneakemail.com> writes:

    John> Hi, there, I recently build pymat (python2.3, matlab 6.5) on
    John> a Linux PC, Everything goes well until I tried to use it in
    John> python2.3:

Not an answer to your question, but I just wanted to point out in case
you didn't know about any of these packages that you can get a lot of
matlab's functionality out of Numeric, scipy and matplotlib.

For example, compare the following matlab and python scripts below

#python
from matplotlib.matlab import *
dt = 0.01
t = arange(0,10,dt)
nse = randn(len(t))                 # white noise
r = exp(-t/0.05)
cnse = convolve(nse, r, mode=2)*dt  # colored noise
cnse = cnse[:len(t)]
s = 0.1*sin(2*pi*t) + cnse
figure(1)
plot(t,s)

figure(2)
psd(s, 512, 1/dt)
show()


% matlab
dt = 0.01;
t = [0:dt:10];
nse = randn(size(t));
r = exp(-t/0.05);
cnse = conv(nse, r)*dt;
cnse = cnse(1:length(t));
s = 0.1*sin(2*pi*t) + cnse;
figure(1)
plot(t,s)

figure(2)
psd(s, 512, 1/dt)


JDH




More information about the Python-list mailing list