Calculate phase and amplitude of a sampled sine wave I have an electronics project where I sample two sine waves. I would like to know what the amplitude (peak) and difference in phase is. Actually I just need to know the average product of the two waves.
A caveat I have is that the two sine waves have been rectified. (negatives cut off) Here is what I expect the samples to look like:

I don't have much experience with signal processing. Can you recommend any reading or topics to research?
 A: You could try to use a Least Squares Estimator (ls-estimator). It can fit a curve with unknown amplitude an phase to a signal. A least squares estimator always consists of an observation matrix. In this you can "design" your "cuttet sine wave" like this (if one period of your sine wave consists of 8 samples an your signal only contains one period):
x1 = [0 0.707 1 0.707 0 0 0 0]^T

To estimate the phase (and the true amplitude) you must fit a cosine wave, too:
x2 = [0 0 0 0 0 0.707 1 0.707]^T

So you observation matrix (to estimate amplitude and phase of one sinewave with know frequency) is:
X = [x1, x2]

The formular of the least square estimator is:
b = (X^T * X)^(-1) * X^Ty

with b containing the amplitdue of the sine and the cosine wave.
BTW ls-esitmator is quite powerfull an can be applied to many problems. It's worth to learn. Good look.
This paper paper shows the main ideas within the first two pages: 
A: You don't even know the frequency, because of aliasing.  
Here a sine wave gets undersampled two different ways.  
The red curve could be made a perfect fit with Fast Fourier Transform.


I was worried I couldn't reproduce the sine wave with the long stretch of zeros, but discrete Fourier transform to the rescue!

