https://isaacphysics.org/questions/square_pulse?stage=a_level
Ok so part B seems easy - A square-wave pulse of peak value 5.0V and duration 20ms is applied across a series combination of a 2.0kΩ resistor and a 5.0μF capacitor.

Find the voltage across the resistor at t=40ms (remembering that the square wave was applied between 0 and 20ms). Take the direction of the voltage across the resistor to be positive during the time when the square-wave was applied.

My formula is V_0*e^(-20ms/(2x10^3x5x10-6) where V_0 is 5 volts. However I keep getting the answer wrong and I’m not sure why. The reason why t is 20ms is because the period of the square pulse is 20ms. Can someone tell me where I’m going wrong??
(edited 3 weeks ago)
The time constant is 0.01s and the pulse width is 0.02s
two time constants isn't long enough for the capacitor to fully discharge to 2sf of precision.

if you look at the blue trace in graph A does it look like the negative peak at 0.01 is exactly -5.0V?
if you call the PD at the end of the smooth exponential decay between t=0 and t=0.02 V1
then the negative peak is V1 - 5 and the second exponential curve decay starts there.