# Square wave transfer function?

I made a mathematical model (transfer function) of a rlc circuit. I simulated it in matlab simulink with step input and square wave input and observed the result. I can also calculate this system with step input since its transfer function is simple 1/s. But i do not know how to calculated square wave transfer function. Is there a way to find square wave transfer function or just i have to break the signal in to high or low form. THanks

I thought I would expand a little on the answer offered by Karlo.

Long story short, I would not try to calculate the analytical time response of a system to a square wave. That would be a serious pure-maths exercise, and not necessary for most engineering applications.

Instead, I would suggest using the step response analytical vs. simulated to validate your model, and then trust that your MATLAB Simulink model is working properly for the square wave case.

But if you feel like trying it out, here is what you need to know:

The transfer function $G(s)$ is a description of the relationship between the input $U(s)$ and output $Y(s)$ of your system.

$$G(s) = \frac{Y(s)}{U(s)}$$

When you want to determine the time response of your system to a specified input analyticalally, you rearrange for $Y(s)$ and then use the inverse Laplace Transform:

$$Y(s) = G(s)U(s)$$

$$y(t) = \mathcal{L}^{-1}\{G(s)U(s)\}$$

As stated in the Question, for a simple step input $U(s) = \frac{1}{s}$ the time response is then:

$$y(t) = \mathcal{L}^{-1}\{\frac{G(s)}{s}\}$$

It gets a lot more difficult for a square wave. A square wave is a series of time-shifted step functions (or Heaviside functions) $H(t-T)$ where $T$ is the time at which the step occurs. The derivation for the Laplace transform of a square wave is given in the answer to this question by alexjo:

$$u(t) = A\sum_{k=0}^{\infty} \left[H\left(t-kT\right)-2H\left(t-\frac{2k+1}{2}T\right)+H\left(t-(k+1)T\right)\right]$$ $$U(s) =\frac{A}{s}\frac{1-\mathrm e^{-\frac{Ts}{2}}}{1+\mathrm e^{-\frac{Ts}{2}}}$$

Where $A$ is the amplitude of the square wave. You would then multiply this expression by your transfer function and then take the inverse Laplace transform of the entire mess. I am not aware of any simple way of doing this. Good luck.

• You could just take the Fourier series of a square wave (instead of viewing it as a series of delayed steps) and calculate the response of each frequency. Either stop after a couple of terms, because high frequencies become negligible or try to see if you can see a pattern to which the total will converge. – fibonatic Feb 23 '17 at 23:13
• Good point. I don't do much Fourier analysis so I analyzed it from a Laplace perspective. When all you have is a hammer, everything looks like a nail! You should add an answer from a Fourier perspective. If it addresses the problem more neatly I will be sure to upvote you. – ConjuringFrictionForces Feb 23 '17 at 23:19
• Yes.Thanks. It helped me a lot and now i was also able to find the laplace transform of rectangular wave of any duty cycle. F(s)=(A/s)(1/(1-exp(-sT)))(1-exp(-DTs)+exp(-Ts)) where D is duty cycle range from 0 to 1. Yes Karlo was right i wrote wrong statement (transfer function). Thanks. – Taha Feb 24 '17 at 11:11

You want to look for the Laplace transform of a square wave.

Note: The transfer function $H(s)$ is the ratio of the Laplace transforms of output $Y(s)$ and input $U(s)$: $Y(s)=H(s)\cdot U(s)$

If you take the Laplace transform of a function (input our output), it is not called a transfer function.