Calculations below are locked to 50% Duty Cycle.
The square wave signal can be represented with a function in time like this.
Here is an example of a curve with some iterations in the sum, and frequency 120Hz.
The Circuit looks like this
And the output of the filter is calculated like this, represented in the complex plane.You should understand what this equation means, otherwise the rest will be pretty cryptic :P
Now we can laplace transform the square wave signal, and replace that with Vin in the formula above.
First I take the the inside of the sum from the square wave function.
And also this
Now, for the inverse laplace transform, take the laplace result from above and replace with Vout in the low-pass filter equation. This is complicated :)
This results in:
And we will not forget the small sum in the beginning, that can be calculated separetely.
This becomes a long and complicated function of time, this could maybe be simplified.
Here is an example, displaying the input square wave, and the output signal, the circuit is C=47uF, R=5k and the frequency is 120Hz square signal from 0-5V.