Commit 33536bd9 authored by MEULE Samuel's avatar MEULE Samuel
Browse files

Ajout du fichier .py et du notebook jupyter .ipynb pour TD1

# Historique
Création d'un git pour Stat
parent 9cc4274e
Ajout du fichier .py et du notebook jupyter .ipynb pour TD1
# Historique
Création d'un git pour Stat
# TD_Stat
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#!/usr/bin/python\n",
"# coding: utf-8\n",
"\n",
"#################################################\" \n",
"## MODULES #####\"\n",
"#################################################\"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"#################################################\"\n",
"\n",
"# Parameters\n",
"N = 500 # Number of sampling\n",
"Tmax = 2.0 # Max time\n",
"Te = Tmax/N # Delta time between each measurements\n",
"f1=1 # Acquisition frequency\n",
"t = np.arange(0, Tmax, Te) # Time vector\n",
"\n",
"# Functions\n",
"u1=0.5*1.0*np.cos(2*np.pi*f1*t)\n",
"u2=0.3*np.cos(2*2*np.pi*f1*t-np.pi/3)\n",
"u=u1+u2\n",
"\n",
"# Figure\n",
"fig1=plt.figure(figsize=(10,5))\n",
"plt.plot(t,u, 'k', label='u')\n",
"#plt.hold(True)\n",
"plt.plot(t,u1, 'r--', label='u1')\n",
"plt.plot(t,u2, 'g--', label='u2')\n",
"\n",
"plt.legend()\n",
"plt.xlabel(\"t\")\n",
"plt.ylabel(\"u\")\n",
"plt.axis([0,2,-2,2])\n",
"plt.grid()\n",
"\n",
"\n",
"# Save the figure\n",
"fig1.savefig('Figure_TD1',dpi=200)\n",
"# Show the figure\n",
"plt.show()\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
%% Cell type:code id: tags:
``` python
#!/usr/bin/python
# coding: utf-8
#################################################"
## MODULES #####"
#################################################"
import matplotlib.pyplot as plt
import numpy as np
#################################################"
# Parameters
N = 500 # Number of sampling
Tmax = 2.0 # Max time
Te = Tmax/N # Delta time between each measurements
f1=1 # Acquisition frequency
t = np.arange(0, Tmax, Te) # Time vector
# Functions
u1=0.5*1.0*np.cos(2*np.pi*f1*t)
u2=0.3*np.cos(2*2*np.pi*f1*t-np.pi/3)
u=u1+u2
# Figure
fig1=plt.figure(figsize=(10,5))
plt.plot(t,u, 'k', label='u')
#plt.hold(True)
plt.plot(t,u1, 'r--', label='u1')
plt.plot(t,u2, 'g--', label='u2')
plt.legend()
plt.xlabel("t")
plt.ylabel("u")
plt.axis([0,2,-2,2])
plt.grid()
# Save the figure
fig1.savefig('Figure_TD1',dpi=200)
# Show the figure
plt.show()
```
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment