efrei/theorie-signal/exercices/plot.py

16 lines
296 B
Python
Executable file

#!/usr/bin/env python3
import math
output = []
for x in range(-70, 71):
f = x/10
T = 2
if f == 0:
sinc = 1
else:
sinc = ((math.sin(math.pi * f * T)) / (math.pi * f * T)) ** 2
s = (T**2) * (sinc**2)
output.append(str((f, s)))
print(" --\n".join(output))