Simulation of the Fender Rhodes
This section describes the port-Hamiltonian modeling of the Fender Rhodes Piano and gives some audio examples.
This section describes the port-Hamiltonian modeling of the Fender Rhodes Piano and gives some audio examples.
Le système se compose des éléments suivants:
On définit:
import sympy as sp
x = sp.symbols(['phi_L','q_C'])
le hamiltonien du système
Python ne propose pas directement de fonctionnalités pour le calcul numériqe. Elles sont chargées depuis des modules externes. Les plus utilisés sont numpy
pour les structures de données numériques (numpy.array
, numpy.matrix
).
Python itself does not provide usefool ttools for numerical computations. So we have to import them. Ther is several ways to import modules:
from module import *
f1
and f2
from a given module
withfrom module import f1, f2
import module as label
# Load Plot module
import matplotlib.pyplot as plt
# This line configures matplotlib to show figures embedded in the notebook,
# instead of poping up a new window.
%matplotlib inline
# Load numerical module
import numpy as np
eps = np.spacing(1) # numerical precision
from IPython.display import Latex
On souhaite afficher la courbe $A\sin(2\pi f_0t)$ pour $t\in [0,1]$. Tout d'abord on définit un signal
$$\begin{eqnarray} \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\ \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\ \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\ \nabla \cdot \vec{\mathbf{B}} & = 0 \end{eqnarray}$$$s(f_0)=A\sin(2\pi f_0t)$, puis on l'utilise récursivement.
# Time Vector
t = np.linspace(0,1,300)
# Signal function
A = 10 # Amplitude (V)
s = lambda f0: A*np.sin(2*np.pi*f0*t)
axis = plt.axes()
# Plot for a list of f0
for f0 in np.linspace(1,2,3):
label = '$f_0=$'+str(f0)
axis.plot(t, s(f0), label=label)
# Plot axis
axis.set_xlabel('Temps (s)')
axis.set_ylabel('Amplitude (V)')
# Plot label and legend
axis.set_title('$\sin(2\pi f_0 t)$')
axis.legend(loc=0) # option loc=0 set location with minimal overlap
# activate a grid
axis.grid()
Ici on somme les trois signaux pour visualiser une forme d'onde complexe i.e. nonpure.
plt.plot(t, [np.sum(e) for e in zip(*[s(f0) for f0 in [1,2,3]])], label='$\sum_{i=1}^3 S_i(t)$')
# Plot axis
plt.xlabel('Temps (s)')
plt.ylabel('Amplitude (V)')
# Plot label and legend
plt.title('$\sin(2\pi f_0 t)$')
plt.legend(loc=1) # option loc=0 set location with minimal overlap
# Show the plot
plt.show()
Write your post here.
Dans ce post, nous détaillons l'approche par les système-Hamiltoniens à Ports pour la modélisation passive de systèmes physiques à temps continu.
- Nous rappellons quelques notions de la théorie des systèmes (représentation d'état, passivité, fonctionnelle de Lyapunov, etc.)
- Nous rappelons la structure Hamiltonienne à port introduite par A.J. Van der Schaft et B. Maschke
- Nou smontrons la construction d'un SHP à partir d'une netlist
<embed src="two.mp3" width="140" height="40" autostart="false" loop="FALSE"></embed>