-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_filter.py
49 lines (36 loc) · 1.1 KB
/
plot_filter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import csv
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal as signal
import numpy as np
from scipy.fft import ifft, fft, fftfreq, fftshift
header = []
data = []
filename = "bode_filter2_copy.csv"
with open(filename) as csvfile:
csvreader = csv.reader(csvfile)
header = next(csvreader)
for datapoint in csvreader:
values = [float(value) for value in datapoint]
data.append(values)
print(header)
print(data[0])
#print(data[1])
freq = [p[0] for p in data]
# ch1 = [p[1] for p in data]
ch2 = [p[2] for p in data]
plt.plot(freq,ch2)
plt.xscale('log')
#plt.plot(time,ch1)
# plt.grid(color='black', linestyle='-', linewidth=1)
plt.xlabel('Frekvens [Hz]', fontsize=20)
plt.ylabel('Amplitude [dB]', fontsize=20)
plt.grid(b=None, which='major', axis='both')
plt.grid(b=None, which='minor', axis='both')
plt.tick_params(axis='both', which='major', labelsize=16)
plt.tight_layout()
#plt.xlim([-0.002,0.002])
# matplotlib.rc('xtick', labelsize=15)
# matplotlib.rc('ytick', labelsize=10)
plt.show()