声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 799|回复: 0

[FFT] 請教快速傅立葉的用法

[复制链接]
发表于 2008-3-14 16:56 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
這個程式跟小弟以往看到的寫法不一樣,請各位高手解答一下
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;
回复
分享到:

使用道具 举报

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-26 21:26 , Processed in 0.067608 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表