I have a staircase generator circuit with a Mosfet connected to capacitor 2. The input of the capacitor is connected to a comparator and I wish for the Mosfet to cutoff when the output of the comparator is high. The comparator is connected to a sine wave generator The waveform I want to achieve is shown below. I am having problems achieving this, when the Mosfet is disconnected as above, the wave form I get is this. So the blue staircase wave is working as intended albeit no resetting. However the moment I connect it the staircase waveform is affected with some weird fluttering at the beginning and then it not resetting the staircase anyway . I have confirmed that with a manual switch the staircase resets as needed however I cannot get the transistor to work as intended.
It cannot work like that. The mofet discharges the capacitor just down to the value where VStaircase goes a bit lower than Vsine, not down to zero as you wish. It's a negative feedback, that it should do.
To act as you wish you need to trigger a short impulse that fully opens the mosfet for a short time.