Your web browser must have JavaScript enabled in order for this application to display correctly.
Switching Mixer Explorer
import math import matplotlib.pyplot as plt class mixer(): def __init__(self,RFin,LOin): self.RF = RFin self.LO = LOin rng = range(200) self.xrng = list(0.0005 * x for x in rng) self.updatePlot() def updateValues(self,inRF,inLO): self.RF = inRF self.LO = inLO plt.clf() self.updatePlot() def updatePlot(self): self.f1 = list(math.sin(x*self.RF*180/math.pi) for x in self.xrng) self.f2 = list(math.sin(x*self.LO*180/math.pi) for x in self.xrng) self.diff = list(math.cos(x*math.fabs(self.RF-self.LO)*180/math.pi) for x in self.xrng) self.sumf = list(-1*math.cos(x*(self.RF+self.LO)*180/math.pi) for x in self.xrng) self.switch = list() for index, item in enumerate(self.f2): if item > 0: self.switch.append(1) else: self.switch.append(-1) self.product = list() for index, item in enumerate(self.f1): self.product.append(item * self.switch[index]) plt.plot(self.xrng,self.product) plt.plot(self.xrng,self.f2) plt.plot(self.xrng,self.diff,'r:,') plt.show() if __name__ == "__main__": mainMixer = mixer(15,10)
RF:
LO:
Update