Thank you for you and everyone else’s reply. Apologies for my late response, the arduino website has banned my acc from having too many replies per day (since it is a newly created account)
Thanks to all your suggestions, so far I have constructed a peak inverter circuit, and managed to hold the positive part of my input sine wave. Now I’m working on implementing a transistor to invert the signal before passing it through my peak inverter circuit.
Thanks again!