The following relation gives me the measurements of interest $w$ at equally distanced locations $x_j$ in space:


where $A_m$ are the Fourier coefficients of sine series and $L$ the total length is physical space. I also assume $m = 1,2,...,11$.

Now, how can I obtain the coefficients $A_m$ given the data $w_j$ ?

  • $\begingroup$ i think this question is better suited for signal proc. SE. $\endgroup$
    – gunes
    Commented Aug 31, 2020 at 11:34
  • $\begingroup$ You equation doesn't make sense to me. Did you mean something more like this? $$ w_j=\sum_{m=1}^{L}A_m\sin\frac{mπx_j}{L} $$ Also, are your $x_j$ locations uniformly spaced? $\endgroup$ Commented Sep 1, 2020 at 0:36
  • $\begingroup$ You are right. I edited my question. Thank you. $\endgroup$ Commented Sep 2, 2020 at 9:00

2 Answers 2


With the correction, it can now be answered.

I will assume that you have also have 11 readings. Fewer and you are underdetermined, with more you are overdetermined.

Express your problem in matrix form.

$$ \begin{bmatrix} w_1 \\ w_2 \\ w_3 \\ : \\ w_{11} \\ \end{bmatrix} = \begin{bmatrix} \sin\left(\frac{ \pi x_1}{L}\right) & \sin\left(\frac{2 \pi x_1}{L}\right) & \sin\left(\frac{3 \pi x_1}{L}\right) & \dots & \sin\left(\frac{11 \pi x_1}{L}\right) \\ \sin\left(\frac{ \pi x_2}{L}\right) & \sin\left(\frac{2 \pi x_2}{L}\right) & \sin\left(\frac{3 \pi x_2}{L}\right) & \dots & \sin\left(\frac{11 \pi x_2}{L}\right) \\ \sin\left(\frac{ \pi x_3}{L}\right) & \sin\left(\frac{2 \pi x_3}{L}\right) & \sin\left(\frac{3 \pi x_3}{L}\right) & \dots & \sin\left(\frac{11 \pi x_3}{L}\right) \\ : & : & : & ::: & : \\ \sin\left(\frac{ \pi x_{11}}{L}\right) & \sin\left(\frac{2 \pi x_{11}}{L}\right) & \sin\left(\frac{3 \pi x_{11}}{L}\right) & \dots & \sin\left(\frac{11 \pi x_{11}}{L}\right) \\ \end{bmatrix} \begin{bmatrix} A_1 \\ A_2 \\ A_3 \\ : \\ A_{11} \\ \end{bmatrix} $$

This can be seen as:

$$ W = S A $$

The solution is:

$$ A = S^{-1} W $$

This is very similar to my two answers here:

Reconstructing a sine wave from an interval shorter than half its wavelength

In the overdetermined case:

$$ W = S A $$

$$ S^T W = S^T S A $$

$$ A = (S^T S)^{-1} S^T W $$

This is done inside np.linalg.solve, so you just need to use that (or your platform equivalent).

  • $\begingroup$ This looks nice. But what if I have more than 11 readings as my case? In that case matrix manipulations are not applicable.. $\endgroup$ Commented Sep 2, 2020 at 14:15
  • $\begingroup$ @DimitrisGeorgiadis If you have more readings, you are overdetermined. In this case you will get a best fit solution. See followup. $\endgroup$ Commented Sep 2, 2020 at 14:25
  • $\begingroup$ I get the determinant of S equal to zero. Any solutions? $\endgroup$ Commented Sep 3, 2020 at 7:40
  • $\begingroup$ @DimitrisGeorgiadis Or if the determininant of $(S^TS)^{-1}$ is zero, you are underdetermined. You can get a solution but it won't be unique. It is probably better to reduce your model size from 11. Since $S$ is based on the $x_j$ values, and not your $w_J$ values, it means you don't have enough distinct domain points. $\endgroup$ Commented Sep 3, 2020 at 11:55

In accordance with the case of a continuous function $f(x)$ where $$b_n=\frac{2}{L}\int_{0}^Lf(x)\sin\left(\frac{mπx}{L}\right)dx$$ I came with the following expression: $$A_m=\frac{1}{N-1}\sum_{n=1}^{N}w_n\sin\left(\frac{mπx_n}{L}\right)$$

Can anyone confirm or not that solution?


Your Answer

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

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