资源简介
NUFFT的算法,1D、2D、3D的还另有几个C语言代码
代码片段和文件信息
%test script fgg_1D_experiment.m for the 1D NFFT based on Fast Gaussian
%Gridding.
%
%NOTE: In order for this FGG_1D to work the C
%file “FGG_Convolution1D.c“ must be compiled into a Matlab executable
%(cmex) with the following command: mex FGG_Convolution1D.c
%
%Code by (send correspondence to):
%Matthew Ferrara Research Mathematician
%AFRL Sensors Directorate Innovative Algorithms Branch (AFRL/RYAT)
%Matthew.Ferrara@wpafb.af.mil
clear all;
close all;
%clc
%path(path ‘./nfftde‘);%NFFT mex files from Potts et al.
% make an “image“
%Note for even lengths the Nfft routine defines the image-space origin
% at pixel location [Nx/2 + 1 Ny/2 + 1].
% Convention: x counts down rows y counts L to R columns.
N=16;%even length assumed below...tedious to generalize...
z = zeros(N1);%
%Make a step function:
z(8:12)= 1;
%imagesc(z)
img=double(z);
% Now let‘s compute a matlab DFT in d dimensions using the “nfft“ command.
% Note use fftshifts to match indexing convention as used above in Pott‘s
% nfft.
data=fftshift(ifftn(ifftshift(img)));
DFTout = fftshift(fftn(ifftshift(data)));
data=data(:);
% We need knots on [-1/2 1-1/Nx]x[-1/2 1-1/Ny] as fundamental period.
% make square grid of knots for exact comparison to fft
tmpx = linspace(-1/21/2 -1/N(1) N(1));% tmpx(end)=[];
%this creates N+1 points then discards point at +0.5.
%store my K knots as a d-by-K matrix (d=2 dimension here)
%...following four lines could be cleverly vectorized avoiding loop.
knots=[tmpx(:)];
Nx=[N];
%set the desired number of digits of accuracy desired from the NUFFT
%routine:
Desired_accuracy = 6;%6=single precision 12=double precision.
tic
MattOut_Gauss=FGG_1d_type1(data(:)knots[Nx]Desired_accuracy);
plot(abs(MattOut_Gauss))
title(‘(Type-I Fast Gaussian Gridding) NFFT output‘)
disp([‘NUFFT evaluated in ‘num2str(toc)‘ seconds‘])
MattOut_T2=iFGG_1d_type2(MattOut_GaussknotsDesired_accuracy);
MattOut_Gauss2=FGG_1d_type1(MattOut_T2(:)knots[Nx]Desired_accuracy);
figure
plot(1:Nabs(MattOut_Gauss2)‘-‘1:Nabs(img(:))‘.‘)
title(‘(Fast Gaussian Gridding) NFFT-I output vs DFT‘)
figure
plot(abs(DFTout(:)-MattOut_Gauss2(:)))
title(‘Error between DFT and NFFT‘)
Mean_Error=mean(abs(MattOut_Gauss(:)-DFTout(:)))
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-02-07 10:19 NUFFT_code\
文件 9561 2009-10-14 05:02 NUFFT_code\FGG_1d_type1.m
文件 10674 2009-10-14 05:02 NUFFT_code\FGG_2d_type1.m
文件 12269 2009-10-14 05:03 NUFFT_code\FGG_3d_type1.m
文件 6805 2009-10-14 05:06 NUFFT_code\FGG_Convolution1D.c
文件 6680 2009-10-14 05:07 NUFFT_code\FGG_Convolution1D_type2.c
文件 8175 2009-10-14 05:07 NUFFT_code\FGG_Convolution2D.c
文件 8283 2009-10-14 05:07 NUFFT_code\FGG_Convolution2D_type2.c
文件 9763 2009-10-14 05:07 NUFFT_code\FGG_Convolution3D.c
文件 9819 2009-10-14 05:07 NUFFT_code\FGG_Convolution3D_type2.c
文件 2301 2009-10-14 05:01 NUFFT_code\fgg_1D_experiment.m
文件 2575 2009-10-14 05:01 NUFFT_code\fgg_2D_experiment.m
文件 2679 2009-10-14 05:01 NUFFT_code\fgg_3D_experiment.m
文件 6538 2009-10-14 05:05 NUFFT_code\iFGG_1d_type2.m
文件 8322 2009-10-14 05:05 NUFFT_code\iFGG_2d_type2.m
文件 7974 2009-10-14 05:05 NUFFT_code\iFGG_3d_type2.m
评论
共有 条评论