Error when plotting voltages and currents with sympy

0

I'm trying to make a code to graph voltages and currents in alternating current and pull error.

This is the code:

import sympy
from sympy import *
from sympy import symbols
import matplotlib.pyplot as plt
import numpy as np
V=float(input("ingrese la tension maxima: "))
R=float(input("ingrese la resistencia: "))
F=float(input("ingrese la frecuencia: "))
w=2*pi*F
t=np.linspace(-10,10)
vr=(V*sin(w*t))
i=(V/R)*sin(w*t)
plt.figure("corriente y voltaje")
plt.title("tension en resistencia")
plt.plot(t,Vr,'r')
plt.xlabel("wt")
plt.ylabel("ir, vr")
plt.plot(t,i,'g')
plt.show()
    
asked by exe 31.08.2017 в 19:36
source

1 answer

1
import matplotlib.pyplot as plt
import numpy as np
V=float(input("ingrese la tension maxima: "))
R=float (input ("ingrese la resistencia: "))
F=float(input("ingrese la frecuencia: "))
w=2*np.pi*F
t=np.linspace(-10,10)
vr=(V*np.sin(w*t))
i=(V/R)*np.sin(w*t)
plt.title("tension en resistencia")
plt.plot(t,vr,'r')
plt.xlabel("wt")
plt.ylabel("ir, vr")
plt.plot(t,i,'g')
plt.show()

You are using the sympy module incorecto, which is intended for symbolic mathematical operations. Your problem can be solved only using numpy.

    
answered by 01.09.2017 в 01:09