How the harmonics are located in prettyFFT

Status
Not open for further replies.

pankaj jha

Full Member level 3
Joined
Apr 16, 2010
Messages
170
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Location
jaipur
Activity points
2,457
Hello all

I am trying to understand the code for the matlab function called "prettyFFT" provided at

https://secure.engr.oregonstate.edu/wiki/ams/index.php/Matlab/PrettyFFT


Can anybody help me understand the section of the code given below:


Code dot - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
% GET HARMONICS
harm = bin;
t=1;
nyqpts=(pts/2-1);
all_harms = harm:step:(harm*nyqpts);
all_harms = mod(all_harms,pts);
all_harms = (pts-all_harms).*(all_harms>nyqpts) + all_harms.*(all_harms<=nyqpts);
all_harms = all_harms.*(all_harms>0 & all_harms<pts/2) + (all_harms<=0) + (all_harms>=pts/2).*nyqpts;
if (maxh==0 || maxh>length(all_harms))
maxh=length(all_harms);
end
for k=1:maxh
if(dbf2(all_harms(k)) > noise_top)
harm(t) = all_harms(k);
hnum(t) = k;
t=t+1;
end
end

 
Last edited by a moderator:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…