Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

confuse about harmonic calculation

Status
Not open for further replies.

lhlblue

Member level 3
Joined
Jan 9, 2013
Messages
56
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,742
in dynamic test code of adc parameter, there is a paragraph to calculate the harmonic distortion, just as follows:

numpt=1024; %sample points
spanh=2;
%Find harmonic frequencies and power components in the FFT spectrum
for har_num=1:10
%Input tones greater than fSAMPLE are aliased back into the spectrum
tone=rem((har_num*(fin-1)+1)/numpt,1);
if tone>0.5
%Input tones greater than 0.5*fSAMPLE (after aliasing) are reflected
tone=1-tone;
end
Fh=[Fh tone];
%For this procedure to work, ensure the folded back high order harmonics do not overlap
%with DC or signal or lower order harmonics
har_peak=max(spectP(round(tone*numpt)-spanh:round(tone*numpt)+spanh));
har_bin=find(spectP(round(tone*numpt-spanh):round(tone*numpt)+spanh)==har_peak)
har_bin=har_bin+round(tone*numpt)-spanh-1;
Ph=[Ph sum(spectP(har_bin-1:har_bin+1))];
end

1, why 'spanh=2'? can it be other value?
2, about 'har_num*(fin-1)+1' in the second red color line, what is the meaning of 'fin-1' and '+1'?
3, in the third red color line, why 'round(tone*numpt)' is added again, and what is the meaning of '-spanh-1'?

thanks.
 

the above code is downloaded from maxim network, but the red color line confuses me.
any advice will be appreciated. thanks.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top