Capacitor Discharge

 

Click here to download MATLAB code and description – find_abc

A capacitor discharge through a resistor/inductor can be described by the equation:

V(t)=c*(exp(-a*t)-exp(-b*t))

The function find_abc is used to determine the variables a, b, and c for this equation.

These variables will be defined such that the resulting curve will produce the following desired values (nomenclature in parentheses is used in the MATLAB code):  (t_Peak_Desired),  (PulseWidth_Desired),   (PulseAmplitude_Desired), and  (Pulse_Off_Desired).

This code can use parallel processes (use_Parallel). Set use_Parallel=1 to use parallelized code or use_Parallel=0 to not use parallelized code.