软件编程版 #102617 层

matlab的fft算法程序如何往出调用呢?

楼主 · 1 楼
我用windows 自带的搜索办法搜索了,发现找到的fft好像不是程序,而是一部分说明。
2 楼
只要找到fft.m这个文件就可以了,打开看看一切 OK
3 楼
怎么样察看fft源代码程序呢?那位大侠知道,望指点一二。
4 楼
Numeical Recipes in C



#include <math.h>
#define SWAP(a,b) tempr=(a);(a)=(b);(b)=tempr

void four1(float data[], unsigned long nn, int isign)
{
unsigned long n,mmax,m,j,istep,i;
double wtemp,wr,wpr,wpi,wi,theta;
float tempr,tempi;

n=nn << 1;
j=1;
for (i=1;i<n;i+=2) {
if (j > i) {
SWAP(data[j],data[i]);
SWAP(data[j+1],data[i+1]);
}
m=n >> 1;
while (m >= 2 && j > m) {
j -= m;
m >>= 1;
}
j += m;
}
mmax=2;
while (n > mmax) {
istep=mmax << 1;
theta=isign*(6.28318530717959/mmax);
wtemp=sin(0.5*theta);
wpr = -2.0*wtemp*wtemp;
wpi=sin(theta);
wr=1.0;
wi=0.0;
for (m=1;m<mmax;m+=2) {
for (i=m;i<=n;i+=istep) {
j=i+mmax;
tempr=wr*data[j]-wi*data[j+1];
tempi=wr*data[j+1]+wi*data[j];
data[j]=data[i]-tempr;
data[j+1]=data[i+1]-tempi;
data[i] += tempr;
data[i+1] += tempi;
}
wr=(wtemp=wr)*wpr-wi*wpi+wr;
wi=wi*wpr+wtemp*wpi+wi;
}
mmax=istep;
}
}
#undef SWAP
application/pdfNR-FFT.pdf
5 楼
fft of Mathlab is a build-in function, if only want use it there are help within the matlab.

If you like to look at the source of algoritm I suggest looking for soem digital signal processing books.

Even that most book only talk abnout radix-2, radix-4, radix-8 which

Complex -> Complex transfer

It is really comfusing about in our world and some question raised -

1) A real signal -- to ---> complex domain what is the meaning in the back ?
2) The "inverse fft" does that recovery the complex domain signal to the orignal signal ?
3) Why need to do this all trouble? Is any "Engineering pritical" and "therical" behined it ?

Go to the google and search for split-radix fft (pair both fft and inverse fft)

A real -> complex
complex -> A real

In engineering, it is a multi-channel communication(modualation - demodulation).
In Math will be in different transfer kernal operation and in different view to the internal itself.









6 楼
引用 (billyc @ 2005年04月21日 22时13分)
Numeical Recipes in C



#include <math.h>
#define SWAP(a,b) tempr=(a);(a)=(b);(b)=tempr

void four1(float data[], unsigned long nn, int isign)
{
unsigned long n,mmax,m,j,istep,i;
double wtemp,wr,wpr,wpi,wi,theta;
float tempr,tempi;

n=nn << 1;
j=1;
for (i=1;i<n;i+=2) {
if (j > i) {
SWAP(data[j],data[i]);
SWAP(data[j+1],data[i+1]);
}
m=n >> 1;
while (m >= 2 && j > m) {
j -= m;
m >>= 1;
}
j += m;
}
mmax=2;
while (n > mmax) {
istep=mmax << 1;
theta=isign*(6.28318530717959/mmax);
wtemp=sin(0.5*theta);
wpr = -2.0*wtemp*wtemp;
wpi=sin(theta);
wr=1.0;
wi=0.0;
for (m=1;m<mmax;m+=2) {
for (i=m;i<=n;i+=istep) {
j=i+mmax;
tempr=wr*data[j]-wi*data[j+1];
tempi=wr*data[j+1]+wi*data[j];
data[j]=data[i]-tempr;
data[j+1]=data[i+1]-tempi;
data[i] += tempr;
data[i+1] += tempi;
}
wr=(wtemp=wr)*wpr-wi*wpi+wr;
wi=wi*wpr+wtemp*wpi+wi;
}
mmax=istep;
}
}
#undef SWAP

以上这些是fft程序么?
谢谢你!!
7 楼
Two java files for fft
1) xtwofft.java
2) FastFourierTransform.java

If you have jdk 1.5 you can build, if you only hvae the java env, you can do

"java xtwofft"

code in enclosed here unzip it first

application/zipjavafft.zip