# Square wave transform

One can define an analogous transform to the Fourier transform that uses square waves as the basis instead of sinusoids. Everything seems to work out in parallel and I imagine one can even come up with a FFT analogue.

We can define the square wave functions in a number of ways. The most direct seems to be

$$sq(t) = { 1 \mbox{ if } \frac{\{t\}}{2\pi} < 0.5, \mbox{ else} -1 }$$ $$cq(t) = sq(t + \pi/2)$$

here $sq(t)$ and $cq(t)$ are analogous to $sin(t)$ and $cos(t)$ resp.

The spectrograms are almost identical(well, there is some artifacting in the square wave case) and I was thinking they would be drastically different(the square wave case being more condensed).

Anyone think they can come up with an FFT version or have some fast hardware they could do some computations of various test cases and send me the spectrums if they are different? Or anyone can prove that they should be identical(or close)?

I am using

$$\int f(\tau) w(t - \tau) (cq(\tau) + isq(\tau)) d\tau$$

as the transform.

-
I would think it would be worse for things like Gibbs phenomena as it represents a zero-hold. – Mikhail Jan 26 '12 at 10:23
A better idea for defining the square wave: why not take $\mathrm{sign}(\sin\,x)$? – J. M. Jan 26 '12 at 10:41
Misha: The square transform would be worse for representing continuous function because it takes an infinite number of square waves. OTH, sin waves are worse to represent square waves as they take an infinite number. There is a huge difference though when one allows the amplitude to depend on time. In this case square ways can precisely represent any continuous wave quite easily but sin waves will require the amplitude to be infinite in some cases(the difference between 0/x and x/0). One can see this by noting that sq(t) = sin(t)/abs(sin(t)) (almost anyways) but sin(t) = abs(sin(t)). sq(t) – Uiy Jan 26 '12 at 12:38
J.M. As I said, there are a number of ways to do it. Using sgn(sin(t)) is more complex since it still requires evaluation of the sinusoid in a computation. It only has a theoretical advantage in some cases. It is identical of course. It has has the issue of how to define sgn. It's moot though how you define them. – Uiy Jan 26 '12 at 12:41