資源簡介
利用VC編寫的matlab mex文件,實現(xiàn)二維非等間距快速傅里葉變換。在matlab中可以像調(diào)用庫函數(shù)一樣調(diào)用nfft2。內(nèi)附有函數(shù)說明文件,及matlab測試程序.

代碼片段和文件信息
clear?all;
clc;
M=1000;
N0=14*1;??????N1=N0;
x=rand(M1)-0.5;????y=rand(M1)-0.5;
f_hat=rand(N1N0)+j*rand(N1N0);
%%%%%%%%%???mode=1
k0=-N0/2:(N0/2-1);??????k1=(-N1/2:(N1/2-1))‘;
[kx?ky]=meshgrid(k0k1);
tic;
for?dd=1:M
????xj=x(dd);
????yj=y(dd);
????temp1=exp(-2*pi*j.*(kx*xj+ky*yj));
????temp2=f_hat.*temp1;
????fjss(dd1)=sum(sum(temp2));
end
toc
tic
fjtest=nfft2(f_hatxy1);
toc
figure;plot(abs((fjtest-fjss))./abs(fjss));grid?minor;
%%%%%%%%%???mode=0
%fjtest=nfft2(f_hatxy0);
%figure;plot(abs(fjtest));grid?minor;
%?xy=importdata(‘D:\Program?Files\Microsoft?Visual?Studio\MyProjects\nfft2d_VCtesting\x_array‘);
%?f_hat=importdata(‘D:\Program?Files\Microsoft?Visual?Studio\MyProjects\nfft2d_VCtesting\f_hat‘);
%?fj=importdata(‘D:\Program?Files\Microsoft?Visual?Studio\MyProjects\nfft2d_VCtesting\fj‘);
%?
%?x=xy(:1);??y=xy(:2);
%?f_hat=f_hat(:1)+j*f_hat(:2);
%?fj=fj(:1)+j*fj(:2);
%?
%?M=19;
%?N0=12;??????N1=14;
%?for?dd=1:N0
%?????index=(dd-1)*N1+(1:N1);
%?????ss(:dd)=f_hat(index);
%?end
%?f_hat=ss;
%?
%?k0=-N0/2:(N0/2-1);??????k1=(-N1/2:(N1/2-1))‘;
%?[kx?ky]=meshgrid(k0k1);
%?
%?for?dd=1:M
%?????xj=x(dd);
%?????yj=y(dd);
%?????temp1=exp(-2*pi*j.*(kx*xj+ky*yj));
%?????temp2=f_hat.*temp1;
%?????fjss(dd1)=sum(sum(temp2));
%?end
%?
%?figure;plot(abs(fjss-fj));grid?minor;
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1219??2009-12-30?14:50??nfft2說明文件.txt
?????文件??????24576??2009-12-30?14:00??nfft2.mexw32
?????文件????1178678??2009-12-30?14:04??matlab_mx_error.bmp
?????文件???????1427??2009-12-30?14:43??matlab_test.m
-----------?---------??----------?-----??----
??????????????1205900????????????????????4
評論
共有 條評論