1

I have an array of data from a function that resemble loosely a sine wave which were obtained through filtering, let's call them A[ ]. They are not smooth or scaled correctly. In another array I have data from a "perfect" sine wave, generated in python through the sin function, let's call them B[ ].

What I want to do in Python is to find the correct array of weights W[ ] so my first data can be "fitted" to the second, in such a way the least square error is minimized

E = sum(A[ ]-W[ ]*B[ ])^2

Practically I want to find the weights so to scale the values of A correctly. My problem is that the standard least square error optimization procedure in Python is the opposite one. How can I do that?

Adam
  • 486
  • 1
  • 8
  • 26
  • Does [Least square method in python?](https://stackoverflow.com/questions/43616993/least-square-method-in-python) provide you with the approach? – itprorh66 Nov 30 '20 at 14:57
  • @itprorh66 No as I said in my question this method does the opposite of what I want. It fits a curve on data and not the other way around. – Adam Nov 30 '20 at 16:52
  • Could you provide an example of A[] and B[]? What approaches have you tried? – itprorh66 Nov 30 '20 at 19:40

0 Answers0