# nufft

## 语法

``Y = nufft(X,t)``
``Y = nufft(X,t,f)``
``Y = nufft(X,t,f,dim)``
``Y = nufft(X)``

## 说明

````Y = nufft(X,t)` 使用采样点 `t` 返回 `X` 的非均匀离散傅里叶变换 (NUDFT)。 如果 `X` 是向量，则 `nufft` 返回该向量的变换。如果 `X` 是矩阵，则 `nufft` 将 `X` 的各列视为向量，并返回每列的变换。如果 `X` 是一个多维数组，则 `nufft` 将沿大小不等于 1 的第一个数组维度的值视为向量，并返回每个向量的变换。 ```

``Y = nufft(X,t,f)` 使用采样点 `t` 计算查询点 `f` 的 NUDFT。要指定 `f` 而不指定采样点，请使用 `nufft(X,[],f)`。`
``Y = nufft(X,t,f,dim)` 返回沿维度 `dim` 的 NUDFT。例如，`nufft(X,t,f,2)` 计算矩阵 `X` 的每行的变换。`
``Y = nufft(X)` 返回 `X` 的离散傅里叶变换，等效于 `fft(X)`。`

## 示例

```t = [0:300 500.5:700.5]; S = 2*sin(2*pi*0.02*t) + sin(2*pi*0.1*t); X = S + rand(size(t)); plot(t,S)```

```Y = nufft(X,t); n = length(t); f = (0:n-1)/n; plot(f,abs(Y))```

```T = 50e-3; % Sampling period of 50 ms for equivalent uniform samples Fs = 1/T; % Sampling frequency of 20 Hz for equivalent uniform samples t = [0:T:300*T 500.5*T:T/2:700.5*T];```

```S = 2*sin(2*pi*0.4*t) + sin(2*pi*2*t); % Signal with peak frequencies at 0.4 Hz and 2 Hz X = S + rand(size(t)); plot(t,S) xlabel("t (seconds)") ylabel("X(t)")```

```Y = nufft(X,t/T); n = length(t); f = (0:n-1)/n*Fs; plot(f,abs(Y)) xlabel("f (Hz)") ylabel("abs(Y)(f)")```

```f = [0:0.5:n/4 n/3+1:n-120]/n*Fs; Y = nufft(X,t,f); plot(f,abs(Y)) xlabel("f (Hz)") ylabel("abs(Y)(f)")```

```C3 = 440 / (2^(21/12)); nOctaves = 3; musicalTones = C3 * 2.^((0:(12*nOctaves-1))/12); toneNames = ["C";"C#";"D";"D#";"E";"F";"F#";"G";"G#";"A";"A#";"B"] + string(3:(3+nOctaves-1)); toneNames = categorical(toneNames, toneNames);```

```fs = 16e3; n = 1:16000; X = 4*cos(2*pi*(440/fs)*n) + 2*cos(2*pi*(554.37/fs)*n) + 3*cos(2*pi*(659.2/fs)*n);```

```Y = nufft(X,[],musicalTones/fs); bar(toneNames(:),abs(Y))```

## 详细信息

### 向量的非均匀离散傅里叶变换

`$Y\left(k\right)=\sum _{j=1}^{n}X\left(j\right){e}^{-2\pi i\text{\hspace{0.17em}}t\left(j\right)\text{\hspace{0.17em}}f\left(k\right)}$`

## 参考

[1] Potter, Samuel F., Nail A. Gumerov, and Ramani Duraiswami. “Fast Interpolation of Bandlimited Functions.” In 2017 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 4516–20. New Orleans, LA: IEEE, 2017. https://doi.org/10.1109/ICASSP.2017.7953011.

[2] Dutt, A., and V. Rokhlin. “Fast Fourier Transforms for Nonequispaced Data.” SIAM Journal on Scientific Computing 14, no. 6 (November 1993): 1368–93. https://doi.org/10.1137/0914081.