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?