Optimization of Diode Circuit using C