Actually, it doesn't need to be normalized. I always do (for what I work on), so thats why I put it in.
Lets say you are sampling at 10khz, and you want to examine your vehicle with a steering input of 2.0 Hz. You can do less, but I would make sure your sinusoid has at least 3 cycles, so your window (data you are working with at one time) should be 1.5 seconds, or 15,000 samples. Generate a sine and cosine wave that would resemble a 2.0 Hz wave in phase with your steering input.
FREQ=2
SAMP_RATE=10000
for x=1 to 15,000
Swave(x)=Sin( (2*PI*FREQ*x)/SAMP_RATE )
Cwave(x)=Cos( (2*PI*FREQ*x)/SAMP_RATE )
end
For each sample in your 1.5 second window, multiply your signal by the corresponding sine and add it to a variable. Do the same for the cosine wave, summing to yet another variable.
A=0
B=0
for x=1 to 15,000
A=A+(Swave(x)*Signal(x))
B=B+(Cwave(x)*Signal(x))
end
Divide each of these variables separately by the total number of samples in your window. This makes sure your amplitude will have the same range as your data does.
A=A/15,000
B=B/15,000
Now use trig to find the amplitude (amount of yaw) and the phase (lag)
Amplitude=2*sqrt(A**2+B**2)
Phase=invtan(A/B)
If you are using matlab, the phase would be atan2(BB,AA), by the way. You may want to try looking online for the Goertzel Algorithm, as well as FFT. The method I explained here is not the fastest, but by far the easiest to implement.
Is this better?