% % pfc.m - power factor correction example for EEPP % Written by Ted Burke - last updated 21-3-2018 % % frequency f = 50 w = 2*pi*f % Load elements R = 800 L = 2 % Reactance and impedance of inductor XL = w*L ZL = j*XL % Calculatye capacitor, capicitor reactance, capacitor impedance C = L/(R^2 + (w*L)^2) XC = -1/(w*C) ZC = j*XC % Check the C value compensates the load Zload = R + ZL Zcomp = (Zload * ZC)/(Zload + ZC) % Permittivity of vacuum and relative permittivity of polyethylene eps0 = 8.854e-12 epsr = 2.25 % Thickness of plastic wrap (cling film) according to Wikipedia d = 12.5e-6 % Required area of capacitor when flat (less required if rolled) A = (d*C)/(eps0*epsr)