0
$\begingroup$

I'm interested in analyzing a windowed signal in terms of a weighted sum of sawtooth waves. Being a somewhat DSP newbie, is there an obvious approach to this? I realize that sawtooth waves don't form an orthogonal basis like sinusoids do, so the problem is probably a bit ill-defined. A least squares solution or some other relaxation would probably suffice.

I could imagine constructing a matrix of sawtooth waves of different fundamental frequencies (cf. DFT/DCT matrix) but I'm not sure e.g. how phase would affect the analysis.

I could also consider low-passing + comb filtering the signal for each fundamental frequency, but constructing an array of such non over-lapping filters would seem cumbersome and inefficient.

Also doing a Fourier transform and running an analysis over all fundamentals and their harmonics would seem feasible, but clumsy.

Is there a go-to solution to a problem like this?

$\endgroup$

1 Answer 1

1
$\begingroup$

Assuming you're doing this in discrete time, you can find the least-squares fit for any collection of functions, orthogonal or not.

The following is straight out of linear algebra:

Let $$\mathbf X = \begin{bmatrix} f_1(k_1) & f_2(k_1) & \cdots & f_N(k_1)\\ f_1(k_2) & f_2(k_2) & \cdots & f_N(k_2) \\ \vdots & \vdots & \ddots & \vdots \\ f_1(k_M) & f_2(k_M) & \cdots & f_N(k_M) \end{bmatrix} \tag 1$$

where $f_n$ is any function of $k$

Then if $\mathbf y = \begin{bmatrix}y(k_1) & y(k_2) & \cdots & y(k_M)\end{bmatrix}^T$ is known and you find the $\mathbf b$ that minimizes the Euclidean distance between $\mathbf y$ and

$$\hat {\mathbf y} = \mathbf X \mathbf b \tag 2$$

you have the weights for your "$y$ is a weighted sum of $f$".

  • In the case of the DFT, if you let $k_n = n - 1$, $N = M$ and $f_n(k) = e^{-j 2 \pi \frac{n - 1}{N}k}$, and poof -- you have the DFT.
  • In the case of $N \le M$, you really want $\mathbf X$ to have rank $M$. Moreover, you would like it to be well conditioned numerically (i.e., to have eigenvalues that are all roughly the same magnitude). If you choose the same definition for $f_n$ as the DFT case, then you're doing a truncated DFT and (essentially) finding the coefficients for a low-pass filtered version of your $\mathbf y$.

I'd make up a set of $f_n$ corresponding to your triangle wave, it's "90 degree" offset, and all their harmonics. Then I'd see if the resulting $\mathbf X$ matrix was full rank and well conditioned. If it is -- try it out, see how things work.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.