Two values need to be defined initially: f and Ts where f is the frequency of sinusoidal signals and Ts is the sampling time period.
In this simulation, f is chosen to be 60 Hz and Ts = 1e-6 seconds.
If the current lags the voltage, the phase difference will be negative.
if the current leads the voltage, the phase difference will be positive.
Amit Singh (2020). Displacement Power Factor (DPF) measurement model (https://www.mathworks.com/matlabcentral/fileexchange/65700-displacement-power-factor-dpf-measurement-model), MATLAB Central File Exchange. Retrieved .