lock in amplifier lock in amlifier algorithm implemented on MATLAB developed mainly for the extraction of harmonics' amplitude and phase from the grid and regenerating them to compensate them.