Total Harmonic Distortion THD for the rectifier I have a circuit with rectifier and this cause the non-linearity and consequently harmonic. I show it on the oscilloscope and then collect the signal from the oscilloscope to the computer by using the Labview. The procedure is to find the Total Harmonic Distortion. Could anyone please guide me what I have to do in order to find the THD?
I know that the f(input),f(sampling), N(number of samples)and M(number of cycles) are very important.
Thanks in advance!
this depends a lot how "good" this estimate needs to be. Here is a "rough &amp; dirty" method.


Put your scope in spectrum analyzer mode. Make sure you see all harmonics. 
Look where the highest harmonic is and that's still visibly sticking out over the noise floor.
Quadruple that frequency and use this as your sample rate. 
Sample your signal for a sizable portion. You want at least a 1000 cycles
Filter the signal with a steep notch filter at the line frequency
Throw away the first 50 cycles or so.
Divide the power of the filtered signal by the power of the unfiltered signal. That's your THD estimate