======================MATH_FFT==================================== Theoretical Noise Floor_dB (Table 1) FFT Points 12Bits 14Bits 16Bits 1024 101 113 125 2048 104 116 128 4096 107 119 131 8192 110 122 134 16384 113 125 137 32768 116 128 140 SNR_dB 74.0 86.0 98.1 FFT _ _ _ _ _ _ _ _ _ _ _ _ OdB Spurious | ^ Free Dyn | | Fundamental | SNR Range | | at_max_signal v |__\ |--|---------------------------RMS_Noise_Level / | | | 3rd Harmonic | _| | __| 5rd Harmonic |/ \/\__|/\/ |_/\/ ----------- Ave Noise Level |______________________________\ (Noise Floor) ^ ^ ^ ^ ^ ^ / Bin_width Sample_rate/Number_Points_FFT F_max Sample_rate/2 RMS Signal A/SQRT(2) (FSR/2)/SQRT(2) 2^(n-1)*q/SQRT(2) ----------------------------------------------------- Theoretical Noise Floor_dB (Table 1) FFT Points 12Bits 14Bits 16Bits 1024 101 113 125 2048 104 116 128 4096 107 119 131 8192 110 122 134 16384 113 125 137 32768 116 128 140 SNR_dB 74.0 86.0 98.1 ------------------------------------------------------------- FFT _ _ _ _ _ _ _ _ _ _ _ _ OdB Spurious | ^ Free Dyn | | Fundamental | SNR Range | | at_max_signal v |__\ |--|---------------------------RMS_Noise_Level / | | | 3rd Harmonic | _| | __| 5rd Harmonic |/ \/\__|/\/ |_/\/ -------Average Noise Level |______________________________\ (Noise Floor) ^ ^ ^ ^ ^ ^ / Bin_width = Sample_rate/Number_Points_FFT F_max =Sample_rate/2 RMS Signal A/SQRT(2) = (FSR/2)/SQRT(2) = 2^(n-1)*q/SQRT(2) RMS Noise = Qn = q/SQRT(12) SNR= RMS_Signal/RMS_Noise = 2^(n-1)*SQRT(6) SNR_pos_dB = 20*log(2^(n-1)*SQRT(6)) = 6.02*n + 1.76 NOISE_FLOOR_neg_dB = 6.02*n + 1.76 + 10*log(N/2) NOISE_FLOOR_neg_dB = 6.02*n +10*log(3*N/(PI*ENBW)) THD_neg_dB= 20*log(SQRT(sum_of_Harm_squared) ) Note: HAR (-dB) SINAD_pos_dB = -20*log( SQRT( SNR^2+THD^2 ) ) SINAD = Singal to noise ratio and distortion ENOB (SNR+Distortion-1.76+20*log(Amp_FS/Amp_Actual))/6.02 ENOB= Effective number of bits fs = Sampling Rate (Hz) fin = Input Signal Frequency (Hz) FSR = Full Scale (Input) Range of Sampling A/D Converter FS = FSRi2 = Full Scale input of Sampling A/D Converter A = Input Signal Amplitude = FS = FSR/2= OdB n = Numberof Bitsof Resolution q = LSB Size LSB = Least Significant Bit N = Numberof FFT Points N/2 = Numberof Frequency Bins (real component) ENBW = Equivalent noise bandwidth of the window function. (For a four-term Blackman-Harris window, ENBW= 2.) --------------------FFT_COS------------------------------ ^ /|\ Signal = SIN(2*P()*Num/8) S--__ __-- | \S_ __S | \_ _/ | \S S/ | \_ _/ | \__ __/ | S__ ___S |_ _ _ _ _ _ _ _ _ _--S-- _ _ _ _ _ \ | / Num Samp FFt 0 2 8 1 1.71 4 2 1 0 3 .29 0 4 0 0 5 .29 0 6 1 0 7 1.71 4 REAL MAGNITUDE ^ /|\ | \ | \ ^ 8 at @bin0 \ /|\ \ ^ | Nyq\_ /|\| \ | | \ | | \| | ^ 4 at @bin1 \ |/|\ \|_|_________________\ \ | / \| IMAGINARY MAGNITUDE \ \ ^ Nyq\_ /|\ 4 at @bin7 \ | \ | \| \ _V J_OMEGA -------------------The_3D_Spectrum--------------------- Tayler discovered that an alternative ways to express a function was to use a power series. This new way of looking at sine and cosine functions lead to the discovery that they were related to the exponental function. COS(X) = 1 - X^2/2 + X^4/(4*3*2) +..etc SIN(X) = + X + X^3/(3*2) +..etc EXP(X) = 1 + X + X^2/2 + X^3/(3*2) + X^4/(4*3*2) +..etc By using complex numbers, Euler was able to find the following relationship. EXP(j*X) = COS(X) -j*SIN(X) In the form below , this relationship effectly translates a time function into a spectrum function. COS(X) = EXP(j*X)/2 +EXP(-j*X)/2 SIN(X) = j*EXP(j*X)/2 -j*EXP(-j*X)/2 A sine wave really needs only three data points to completely define it. By looking at a spectrum, if you know the amplitude and frequency, you still can't relate it to time. You need to know when the sinewave crosses zero in terms of time. In other words, you need to know phase information. Suppose you have a 5Hz signal that has a peak amplitude of 3volts. That is saying that the X term will be 2*PI for every 1/5th of a second. This is expressed below. function(time) = 3*SIN(2*PI*5Hz*time) <--ignoring phase It is traditional to replace a the 2*PI*Freq term with a single unit call Omega or "w". w = 2*PI*Freq If the amplitude is expressed as the term AMP, then.. function(time) = AMP*SIN(2*PI*5Hz*time) <--ignoring phase ^ /|\ | __-----__ | __/ \ _ | _/ \_ _ _|/ _ _ _ _ _ _ _ _ _ \_ _ _ _ _ _ _ _ _ _ _ _ \ | \_ _/ / | \__ __/ | \__ ___/ | ----- To know phase, one has to know in time when the sinewave crosses zero. If at time "zero" the signal is zero, you have a "SINE" wave. Now with the three data points..(Frequency, Amplitude, Phase), you know the signal in terms of voltage versus time. function(time) = AMP*SIN(2*PI*5Hz*time) It is common to express the magnitude and phase of something in terms of a complex number. The ratio to the real to imaginary values of give the phase while the combine distance of the real and imaginary parts give the magnitude. REAL ^ X = valueR +jvalueI /|\ | valueR .|.. __ Magnitude | /| | / : | / __-- Phase | /_--: IMAGINARY |/-___:____________\ : / jvalueI By adding one more dimension to represent frequency, the Euler relationship shows an alternative way to view Frequency, Amplitude, and Phase. Remmenber SIN(X) = j*EXP(j*X)/2 -j*EXP(-j*X)/2 So the function of time can be viewed as a function of frequency. The sine wave is mapped as two vectors along the jw axis. function(time) = AMP*SIN(2*PI*5Hz*time) AMP*SIN(w*t) = j*AMP*EXP(j*w*t)/2 - j*AMP*EXP(-j*w*t)/2 REAL MAGNITUDE ^ /|\ | \ | \ | \ | \ | \ | /______\ <--|- -j*AMP*EXP(-j*w*t)/2 \ \ | \ | \ | IMAGINARY MAGNITUDE \|__________________\ \ / \ \ j*AMP*EXP(j*w*t)/2---> \______\ <--Magnitude = AMP \ / <--Direction = Phase \ <--Position = Freq \ _V J_OMEGA These vectors always come in pairs ( jw and -jw). Where a vector is, how large it is, and which way it is pointed tells frequency, amplitude, and phase. If the phase of the signal happened to be a COSINE, then the 3D spectrum would look like... (Amplitude) REAL MAGNITUDE ^ /|\ | \ | \ | \ ^ | \ /|\ | \ | | \| | AMP*EXP(-j*w*t)/2 \ | \ | (90degree Amplitude) \ | IMAGINARY MAGNITUDE \|__________________\ \ ^ / \ /|\ \ | \| AMP*EXP(j*w*t)/2 \ \ \ \ _V J_OMEGA (frequency) ---------3DS_Amplitude_Modulation_COS----------------- ________________\_ _ _\_ _ _\ 1001KHz at 0 degrees / / / 1000KHz at 0 degrees 999KHz at 0 degrees _ /| / 1001KHz leads 45 degree ________________\/ 1000KHz at 0 degrees /\ 999KHz lag by 45 degrees \ _\| ^ /|\ | 1001KHz leads 90 degree ________________\| 1000KHz at 0 degrees /| 999KHz lag by 90 degrees | \|/ V _ /\ \ 1001KHz leads 135 degree ________________\ 1000KHz at 0 degrees / 999KHz lag by 135 degree / |/_ 1001KHz leads 180 degree ______/ _ _/ _ _\ 1000KHz at 0 degrees \ \ / 999KHz lag by 180 degree ^ (Amplitude) /|\ REAL MAGNITUDE \ | ^ \ ^ | /|\ \ /|\| | \ | | | \| | | \ | ^ | \|/|\ | \ | | \| | \ | ~etc~| ^ \ | /|\ IMAGINARY \|_____|____________\ \ ^ | / \ /|\| MAGANITUDE ~etc~| | \| | \ | ^ \|/|\ \ | \| \ _V J_OMEGA (frequency) ---------3DS_Amplitude_Modulation_SIN----------------- ^ /|\ | __--|--__ __-----__ Sine lags 90 cosine __/ | _\/_ \__ _/ | _/ \_ \_ _ _ / _ _ _ _ |/_ _ _ _ \_ _ _ _ _ \_ _ _ _ _ _ _ \ | \_ \ _/ / | \__ __/ | \__ ___/ ----- _ _ _/| | | | | _ _ | | | | | | | \ / | | | | | | | | | _ | | | | | | | | | | | \ _ | | | | | | | | | | | | _ / | | | | | | | | | | | | | | | | __ _/| | | | | | | | | | | | | | | | | | | | --- | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -- |_| | | | | | | | | | | | | | | | | | |/ |_| | | | | | | | | | | | | | |_/ | | | | | | | | | | | | | \_| | | | | | | | | |_/ \_| | | | | | | |_| |_| |/ ^ /|\ | 1001KHz lags 90 degree ________________\| 1000KHz at 0 degrees /| 999KHz leads by 90 degrees | \|/ V _ /| / 1001KHz lags 45 degree ________________\/ 1000KHz at 0 degrees /\ 999KHz leads by 45 degrees \ _\| ________________\_ _ _\_ _ _\ 1001KHz at 0 degrees / / / 1000KHz at 0 degrees 999KHz at 0 degrees ^ (Amplitude) /|\ REAL MAGNITUDE \ | ^ \ | /|\ \ | | \ | | /____\ | | \ \ | | \| | \ | \____|\ \ |/ ~etc~| ^ \ | /|\ IMAGINARY \|_____|____________\ \ | / \ | MAGANITUDE ~etc~ | /____\ | \ \ | \| \ \____\ \ / _V J_OMEGA (frequency) ---------------3DS_Phase_Modulation--------------------- ^ /|\ | __--|--__ __-----__ Sine lags 90 cosine __/ | _\/_ \__ _/ | _/ \_ \_ _ _ / _ _ _ _ |/_ _ _ _ \_ _ _ _ _ \_ _ _ _ _ _ _ \ | \_ \ _/ / | \__ __/ | \__ ___/ ----- _________________\ /| 1000KHz at 0 degrees | 1001KHz lags 90 degrees \|/ 999KHz lags 90 degrees V | | \|/ V __________________\ 1000KHz at 0 degrees /\ 1001KHz lags 45 degrees / \ 999KHz lags 135 degrees |/_ _\| ___________/_ _ _\_ _ _\ 1000KHz at 0 degrees \ / / 1001KHz lags 0 degrees 999KHz lags 180 degree _ _ |\ /| \ / 1001KHz leads 45 degrees ________________\/ 1000KHz at 0 degrees / 999KHz lags 225 degree ^ /|\ | 1001KHz leads 90 degrees | 1000KHz at 0 degrees ^ 999KHz lags 270 degree /|\ | ________________\| / ^ (Amplitude) /|\ REAL MAGNITUDE \ | ^ \ | /|\ \ | | \ | | /____\ | | \ \ | | \| | \ | /____\ | \ \ | ~etc~| ^ \ | /|\ IMAGINARY \|_____|____________\ \ | / \ | MAGANITUDE ~etc~ | \__|_\ \ | / \| \ \____\ \ / _V J_OMEGA (frequency) ----------------FM_2_PM------------------- _ _ _ _ _ _ _ _ _ _ _ _ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| | Pure sign wave (no FM) _ _ __ __ _ _ _ _ _ _ | | | | | | | | | | | | | | [|[| | | | | | | | | | | | | | | | | | | | |||| | | | | | | | | | | | | | | | | | | | |||| | | | | | | | | | | | | | | | | | | | |||| | | | | | | |_| |_| |__| |_| |_| |_| |_|L||_| |_| |_| A Moving sign wave Frequency Modulate a 1kHz carrier with a 1Hz signwave Freq(t) = [ 1000 + sin(2*PI*t) ] Signal= sin( (Freq(t))*2*PI*t) <--FM format at time = 1/4 The Frequency is 1001 Hz at time = 3/4 The Frequency is 999 Hz Another way to think of it is Phase Modulation... Signal= sin( (1000)*2*PI*t +Phase(t)) <-- PM format the phase will be Integral of FM ... _ / Phase(t) = | 2*PI*sin(2*PI*t)*dt = -cos(2*PI*t) _/ So 1Hz peak FM over 1Hz will generate 1radian peak of PM And to convert FM to PM, just integrate and One Hz FM at One Hz equals One radian PM The PM will lag the FM which causes it. ^ /|\ Freq=1001Hz| Phase= +1radian __--|--__ __-----__ __/ | _\/_ \__ _/ | _/ \_ \_ _ _ / _ _ _ _ |/_ _ _ _ \_ _ _ _ _ \_ _ _ _ _ _ _ \ _/| \_ \_ _/ / __/ | \__ \__ __/ TIME __/ | \__ ___/___ ---- ----- ---- Phase= -1radian Freq=999Hz --------------------FFT_SINE------------------------------- Using Excel to FFT signwaves ^ /|\ Signal = SIN(2*P()*Num/8) | __--S--__ | __S \S_ | _/ \_ _ _S/ _ _ _ _ _ _ _ _ _ \S _ _ _ _ _ _ _ _ _ _ _ \ | \_ _/ / | \__ __/ | S__ ___S | --S-- Num Samp FFt 0 0 0 1 .71 -4i 2 1 0 3 .71 0 4 0 0 5 -.71 0 6 -1 0 7 -.71 4i REAL MAGNITUDE ^ /|\ | \ | \ | /______\ | \ \ | \ | Nyq\__ | \ | \ | \_|____\ \|____/_____________\ -4j /______\ / @bin1 \ \ IMAGINARY MAGNITUDE \ Nyq\__ \ \ \______\ +4j \ / @bin7 _V J_OMEGA --------------------FFT_NYQ------------------------------ ^ /|\ Signal = SIN(2*P()*Num/8) S_ S S S | \ / \ / \ / \ | \ / \ / \ / \ _ _|_ _|_ _|_ _|_ _|_ _|_ _| _ \ _ _ _ \ | | | | | | | | | / | \ / \ / \ / \ / | \S/ \S/ \S/ \S/ | Num Samp FFt 0 1 0 Real \ 1 -1 0 Complex | 2 1 0 Complex | 8 data points in/out 3 -1 0 Complex | 4 1 8 Real / 5 -1 0 6 1 0 7 -1 4 ^ REAL MAGNITUDE ^ /|\ /|\ | | | \ | | \ | | \ | | \ | | \ | | Nyq\| | ^ \ | /|\ \ | | 8 at @bin4 \ | | \|___|_________________\ \ | / \ | IMAGINARY MAGNITUDE \ | Nyq\| \ \ \ \ _V J_OMEGA ----------------FM_2_PM------------------- _ _ _ _ _ _ _ _ _ _ _ _ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| | Pure sign wave _ _ __ __ _ _ _ _ _ _ | | | | | | | | | | | | | | [|[| | | | | | | | | | | | | | | | | | | | |||| | | | | | | | | | | | | | | | | | | | |||| | | | | | | | | | | | | | | | | | | | |||| | | | | | | |_| |_| |__| |_| |_| |_| |_|L||_| |_| |_| A Moving sign wave Frequency Modulate a 1kHz carrier with a 1Hz signwave Freq(t) = [ 1000 + sin(2*PI*t) ] Signal= sin( (Freq(t))*2*PI*t) <--FM format at time = 1/4 The Frequency is 1001 Hz at time = 3/4 The Frequency is 999 Hz Another way to think of it is Phase Modulation... Signal= sin( (1000)*2*PI*t +Phase(t)) <-- PM format the phase will be Integral of FM ... _ / Phase(t) = | 2*PI*sin(2*PI*t)*dt = -cos(2*PI*t) _/ So 1Hz peak FM over 1Hz will generate 1radian peak of PM And to convert FM to PM, just integrate and One Hz FM at One Hz equals One radian PM The PM will lag the FM which causes it. ^ /|\ Freq=1001Hz| Phase= +1radian __--|--__ __-----__ __/ | _\/_ \__ _/ | _/ \_ \_ _ _ / _ _ _ _ |/_ _ _ _ \_ _ _ _ _ \_ _ _ _ _ _ _ \ _/| \_ \_ _/ / __/ | \__ \__ __/ TIME __/ | \__ ___/___ ---- ----- ---- Phase= -1radian Freq=999Hz