﻿# -*- coding: utf-8 -*-

import numpy as np
from matplotlib import pyplot as plt

f, Ue, Us, phi = np.loadtxt("tp12-mesures.dat", skiprows=1, unpack=True)

phi *= -np.pi/180  # conversion en radians
G = Us/Ue
Gdb = 20*np.log10(G)

plt.scatter(f, Gdb)
plt.xscale('log')
plt.xlabel('f (Hz)')
plt.ylabel('GdB')

plt.hlines([max(Gdb), max(Gdb)-3], min(f), max(f))

plt.show()

plt.scatter(f, phi)
plt.xlabel('f (Hz)')
plt.ylabel('φ (rad)')
plt.xscale('log')
plt.show()

