efrei/theorie-signal/exercices/plot_sinc.py

18 lines
319 B
Python
Raw Normal View History

2021-11-27 21:06:43 +01:00
#!/usr/bin/env python3
import math
output = []
for x in range(-70, 71):
f = x/10
2021-11-27 23:37:30 +01:00
T = 1.2
A = 0.7
2021-11-27 21:06:43 +01:00
if f == 0:
sinc = 1
else:
sinc = ((math.sin(math.pi * f * T)) / (math.pi * f * T)) ** 2
2021-11-27 23:37:30 +01:00
s = (A**2) * (T**2) * (sinc**2)
2021-11-27 21:06:43 +01:00
output.append(str((f, s)))
print(" --\n".join(output))