Fréquence et composition de fréquences

by Joseph Razik, on 2019-10-18
frequence_recomposition

Fréquence et composition de fréquences

In [1]:
%pylab inline
Populating the interactive namespace from numpy and matplotlib
In [2]:
def x(n, t):
    return sin(pi * n * t) / float(n) if n != 0 else 0
In [3]:
plot(np.linspace(-1, 1, 100), [x(0, t) for t in linspace(-1, 1, 100)])
Out[3]:
[<matplotlib.lines.Line2D at 0x7f1b7d1c5e80>]
In [4]:
plot(np.linspace(-1, 1, 100), [x(1, t) for t in linspace(-1, 1, 100)])
Out[4]:
[<matplotlib.lines.Line2D at 0x7f1b7d0e10b8>]
In [5]:
plot(np.linspace(-1, 1, 100), [x(3, t) for t in linspace(-1, 1, 100)])
Out[5]:
[<matplotlib.lines.Line2D at 0x7f1b7d0c1ef0>]
In [6]:
plot(np.linspace(-1, 1, 100), [x(5, t) for t in linspace(-1, 1, 100)])
Out[6]:
[<matplotlib.lines.Line2D at 0x7f1b7d027208>]
In [7]:
plot(np.linspace(-1, 1, 100), [sum([x(2 * n + 1, t) for n in range(1)]) for t in linspace(-1, 1, 100)])
Out[7]:
[<matplotlib.lines.Line2D at 0x7f1b7d00bd30>]
In [8]:
plot(np.linspace(-1, 1, 100), [sum([x(2 * n + 1, t) for n in range(2)]) for t in linspace(-1, 1, 100)])
Out[8]:
[<matplotlib.lines.Line2D at 0x7f1b7cf69630>]
In [9]:
plot(np.linspace(-1, 1, 100), [sum([x(2 * n + 1, t) for n in range(3)]) for t in linspace(-1, 1, 100)])
Out[9]:
[<matplotlib.lines.Line2D at 0x7f1b7cf3ec50>]
In [10]:
plot(np.linspace(-1, 1, 100), [sum([x(2 * n + 1, t) for n in range(50)]) for t in linspace(-1, 1, 100)])
Out[10]:
[<matplotlib.lines.Line2D at 0x7f1b7cf1cbe0>]
In [11]:
def plot_recompose(N):
    plot(np.linspace(-1, 1, 100), [sum([x(2 * n + 1, t) for n in range(N)]) for t in linspace(-1, 1, 100)])
In [12]:
import ipywidgets
from ipywidgets import interact
In [13]:
interact(plot_recompose, N=(0, 25, 1))
Out[13]:
<function __main__.plot_recompose>