Diode detector strange discharging
Actually your scope plot is as expected for the components you used.

Between peaks, the capacitor discharges thru the resistor slightly.  When the peak appears, the diode is forward biased and the capacitor voltage rides the input voltage minus the diode drop.  All is fine up to here.

At the input peak, the capcitor is charged to its maximum value, and the input then goes down to be less than the capacitor voltage plus the diode drop.  However, the 1N4001 diode you are using is meant for power line rectification applications, and has a long reverse recovery time.  This means the diode continues to stay "on" for a while after it is reverse biased.  This is why you can see the capacitor voltage follow the downslope of the input signal after the peak.  Eventually the diode turns off, and the capacitor voltage stays reasonably constant due to the R-C time constant being much larger than the time between input waveform peaks.

To fix this, replace the diode with one intended for fast small signal applications, like the 1N4148.  When you do this, take another scope shot and add it to your question.  This could be a great learning opportunity for others about diode reverse recovery time.