Hi again,
That is an exact expression for a first order RC filter. If you want to use second order then we can estimate the peak to peak ripple with this:
First calculate V1:
RC=R*C
V1=(Vs/2)*(1-e^(-t/RC))
where
R is the first resistor,
C is the first capacitor,
Vs is the charging voltage,
t is one half of the total PWM period,
then calculate Vpp with:
Vpp=V1*(RC*e^(-t/RC)-RC+t)/t
where
V1 is calculated above,
R is the second resistor,
C is the second capacitor,
RC=R*C,
t is one half the period of the PWM.
This works when the resistors are large enough such as 10k.
The estimate is based on a charging first order RC excited by a rectangular wave, followed by another first order RC excited by a ramp who's amplitude comes from the first calculation. Using a ramp is possible because the time constant is much longer than the PWM period. The Vs/2 factor ensures that we calculate the worst case ripple because the ripple varies with duty cycle.