%pylab inline
Populating the interactive namespace from numpy and matplotlib
WARNING: pylab import has clobbered these variables: ['source'] `%matplotlib` prevents importing * from pylab and numpy
from scipy.special import eval_chebyt
res = 1024
x_space = linspace(-1,1,res)
plot(x_space, eval_chebyt(2, x_space))
[<matplotlib.lines.Line2D at 0x7f92606a3410>]
t2 = eval_chebyt(2, x_space)
source = cos(2* pi * ((x_space + 1)/2))
plot(source)
[<matplotlib.lines.Line2D at 0x7f9260db5a50>]
index = floor((res - 1) * (source + 1)/ 2).astype(int)
index.dtype
dtype('int64')
plot(index)
[<matplotlib.lines.Line2D at 0x7f926119cc90>]
waveshaped = t2[index]
plot(waveshaped)
[<matplotlib.lines.Line2D at 0x7f9261281e90>]
stem(abs(rfft(waveshaped)))
xlim(0, 10)
(0, 10)
depth = 0.5
index = floor(depth * (res - 1) * (source + 1)/ 2).astype(int)
waveshaped = t2[index]
plot(waveshaped)
[<matplotlib.lines.Line2D at 0x7f925df99990>]
stem(abs(rfft(waveshaped)))
xlim(0, 10)
(0, 10)
t5 = eval_chebyt(5, x_space)
waveshaped = t5[index]
plot(waveshaped)
[<matplotlib.lines.Line2D at 0x7f925deb2350>]
stem(abs(rfft(waveshaped)))
xlim(0, 10)
(0, 10)
t15 = eval_chebyt(15, x_space)
waveshaped = t15[index]
subplot(121)
plot(waveshaped)
subplot(122)
stem(abs(rfft(waveshaped)))
xlim(0, 50)
(0, 50)
res = 102400
x_space = linspace(-1,1,res)
source = cos(2* pi * 1000 * ((x_space + 1)/2))
depth = linspace(0, 1, res)
index = floor(depth * (res - 1) * (source + 1)/ 2).astype(int)
t15 = eval_chebyt(15, x_space)
waveshaped = t15[index]
specgram(waveshaped, NFFT=1024);
ylim(0, 0.5)
(0, 0.5)
t50 = eval_chebyt(50, x_space)
waveshaped = t50[index]
specgram(waveshaped, NFFT=1024);
ylim(0, 1)
(0, 1)
plot(t50)
[<matplotlib.lines.Line2D at 0x7f925de58850>]
t49 = eval_chebyt(49, x_space)
waveshaped = t49[index]
specgram(waveshaped, NFFT=1024);
ylim(0, 1)
(0, 1)
plot(t49)
[<matplotlib.lines.Line2D at 0x7f925de59190>]
shaper1 = eval_chebyt(10, x_space)
shaper2 = tanh(x_space * 6)
plot(shaper1)
plot(shaper2)
[<matplotlib.lines.Line2D at 0x7f925dd7e110>]
waveshaped1 = shaper1[index]
waveshaped2 = shaper2[index]
plot((waveshaped1 + waveshaped2)/2)
[<matplotlib.lines.Line2D at 0x7f925e0d5a10>]
specgram((waveshaped1 + waveshaped2)/2, NFFT=2048);
newshaper = (shaper1 + shaper2)/2
waveshaped = newshaper[index]
plot(waveshaped)
[<matplotlib.lines.Line2D at 0x7f925e1626d0>]
specgram((waveshaped1 + waveshaped2)/2, NFFT=2048);
waveshaped1 = shaper1[index /2]
waveshaped2 = shaper2[index /2]
Pxx, freqs, bins, im = specgram((waveshaped1 + waveshaped2)/2, NFFT=2048);
plot(Pxx[:,50])
[<matplotlib.lines.Line2D at 0x7f92603a0590>]