Menu

[r5913]: / trunk / users_guide / code / matplotlib_matlab.py  Maximize  Restore  History

Download this file

17 lines (13 with data), 727 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# python % matlab
from pylab import * % no import necessary
dt = 0.01 dt = 0.01;
t = arange(0,10,dt) t = [0:dt:10];
nse = randn(len(t)) nse = randn(size(t));
r = exp(-t/0.05) r = exp(-t/0.05);
cnse = conv(nse, r)*dt cnse = conv(nse, r)*dt;
cnse = cnse[:len(t)] cnse = cnse(1:length(t));
s = 0.1*sin(2*pi*t) + cnse s = 0.1*sin(2*pi*t) + cnse;
subplot(211) subplot(211)
plot(t,s) plot(t,s)
subplot(212) subplot(212)
psd(s, 512, 1/dt) psd(s, 512, 1/dt)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.