21 il = il*10**9 elif self.ui.satuan_zl.currentText() == "MΩ": rl = rl*10**6 il = il*10**6 elif self.ui.satuan_zl.currentText() == "kΩ": rl = rl*10**3 il = il*10**3 elif self.ui.satuan_zl.currentText() == "Ω": rl il elif self.ui.satuan_zl.currentText() == "mΩ": rl = rl*10**-3 il = il*10**-3 elif self.ui.satuan_zl.currentText() == "µΩ": rl = rl*10**-6 il = il*10**-6 elif self.ui.satuan_zl.currentText() == "nΩ": rl = rl*10**-9 il = il*10**-9 elif self.ui.satuan_zl.currentText() == "pΩ": rl = rl*10**-12 il = il*10**-12 #operasi perhitungan if (ro==0 and io==0): self.ui.lbl_zl.setText("") self.ui.lbl_errorlz.setText("IMPEDANSI KARAKTERISTIK BERNILAI 0") else: zl = complex(rl, il) / complex(ro, io) zl = complex(round(zl.real, 7),round(zl.imag, 7)) self.ui.lbl_errorlz.setText("") self.ui.lbl_zl.setText(str(zl)) koef = complex((complex(rl, il) - complex(ro, io)) / (complex(rl, il) + complex(ro, io))) koef = complex(round(koef.real, 7),round(koef.imag, 7)) rp = math.sqrt(koef.real**2+koef.imag**2) ip = cmath.phase(koef) ip = (np.degrees(ip)) daya = round((rp**2)*100, 7) daya1= round(100-daya, 7) rp = round(rp, 7) ip = round(ip, 7) polar = str(rp)+" ∠ "+str(ip)+"°" self.ui.lbl_r1.setText(str(koef))
RkJQdWJsaXNoZXIy MTM3NDc5MQ==