請教快速傅立葉的用法
這個程式跟小弟以往看到的寫法不一樣,請各位高手解答一下clc
clear all
for k=1:6
a=num2str(k,'3d%d.txt')
forg = load(a);
a1 = forg(:,1);
a2 = forg(:,2);
L=12000;% data length__ 1 minute;
dt=0.005;% sampling rate;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Nstart=1;
Nend=Nstart+L-1;% sampling end point;
b1=a1(Nstart:Nend);
b2=a2(Nstart:Nend);
t=0:dt:(L-1)*dt; <----為什麼這裡要乘上"dt"
Fs=200;
Tmeas=[(L-1)/Fs]; <----這一段的功能是什麼呢?
Fmean1=sum(b1)/L;<----這一段的功能是什麼呢? 小弟覺得是做歸一不知想法對不對
Fmean2=sum(b2)/L;<----這一段的功能是什麼呢?
F1=b1-Fmean1;
F2=b2-Fmean2;
f = Fs*(0:(L/2))/L;<----為什麼這裡要乘上"Fs"
df=max(f)/(L/2); <----為什麼這裡要取f的對大值出來
%%%%%%%%%%%%%%%%% Fourier Transform %%%%%%%%%%%%%%%%%%%
FF1=fft(F1)*dt; ;<----為什麼這裡要乘上"dt"
PffF1=FF1.*conj(FF1)/(L*dt);
I01=sum(PffF1(1:[(L/2)+1])*df);<----為什麼這裡要乘上"df"
FF2=fft(F2)*dt;
PffF2=FF2.*conj(FF2)/(L*dt);
I02=sum(PffF2(1:[(L/2)+1])*df);
ddf=Fs/L;
m0=1;
m1=100/ddf;% maximum frequency=100 Hz;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Fourier Transform&Power spectrum
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
df=max(f)/(L/2);
ddf=Fs/L;
m0=1;
m1=4/ddf;
m2=8/ddf;
m3=13/ddf;
m4=30/ddf;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Fz%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%為什麼都要乘上"df"小弟真的看不懂,@@:@L
It1=sum(PffF1(m0:m4)*df)
Iall1=sum(PffF1(1:[(L/2)+1])*df);
Idelta1=sum(PffF1(m0:(m1-1))*df);
Itheta1=sum(PffF1(m1:m2)*df);
Ialfa1=sum(PffF1((m2+1):m3)*df);
Ibeta1=sum(PffF1((m3+1):m4)*df);
ndelta1=100*Idelta1/It1;
ntheta1=100*Itheta1/It1;
nalfa1=100*Ialfa1/It1;
nbeta1=100*Ibeta1/It1;
页:
[1]