I have some problem with my mini project. My code is using for calculate r l c or cut off frequency and plot the Magnitude graph of it by showing in user interface. But the graph did not come out and showed this kind of error [enter image description here][[[[enter image description here](https://i.sstatic.net/JTkAUM2C.png)](https://i.sstatic.net/DnAQzi4E.png)](https://i.sstatic.net/Md1mM1pB.png)
Here’s the code for the problem section.
Plot Graph
def graph():
global rc_highpass ,rc_lowpass,rl_highpass,rl_lowpass
resistance = choice2.get()
farad = choice1.get()
for i in range(0,5):
if farad == F_U[i]:
c = c_value/(10**(0+(3i)))
if resistance == Ohms[i]:
r = r_value/(10**(3-(3i)))
f = np.linspace(0,1000000,1000000)
class voutrc:
def __init__(self,f,r,c):
self.f=f
self.r=r
self.c=c
def highpass(self):
omega = 2*np.pi*f
vout=( 1j*r*omega*c/(1j*r*omega*c+1.))
return(vout)
def rc_highpass():
window3 = Tk()
window3.title("กราฟ")
window3.geometry("600x400+400+200")
F_CUT = fcut()
fc = F_CUT.rc(r,c)
vout_np = voutrc(f,r,c)
vout_l = vout_np.highpass()
dB= 20*np.log10(np.abs(vout_l))
fig = plt.figure(figsize = (10, 8))
plt.plot(f,dB)
plt.plot([fc,fc],[0,-50],"r--",label="Cut off frequency")
plt.title("Highpass RC")
plt.xlabel("F [Hz]")
plt.ylabel("dB")
plt.xscale("log")
plt.grid(True)
plt.tight_layout()
# creating the Tkinter canvas
# containing the Matplotlib figure
canvas = FigureCanvasTkAgg(fig,
window3)
canvas.draw()
# placing the canvas on the Tkinter window
canvas.get_tk_widget().pack()
window3.mainloop()
I expected that the graph should be like ths[[[enter image description here]
Thyriod is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.