# Need (Basic) Help Using nufftn for Complex-Valued Scalar Function of 2 Variables

2 vues (au cours des 30 derniers jours)
Mike Sheffler le 24 Mai 2020
Commenté : Mike Sheffler le 13 Déc 2021
I have a complex-valued function of two real variables. I need to take the FFT of this two-dimensional complex matrix. Problem is, the sample points -- my two real variable inputs -- are not uniformly spaced in their domain.
Currently, my strategy is to create a scatteredInterpolant, iterate over a regularly-spaced grid, query the interpolant at those regular ('uniform') spacings, and then feed the uniformly-sampled data into fftn. Creation of the scattered interpolant looks like this:
F = scatteredInterpolant(Is, Js, Vs, 'linear', 'nearest');
The variable Vs is my scalar complex valued function that I sample at Is and Js, so for some i, you have Vs(i) is a function of Is(i) and Js(i). This strategy works, but building the uniform data by iterating and querying the scattered interpolant is kind of painful. I'd like to test drive using nufftn to solve this problem; my issue is that I don't seem to understand how to set up a problem correctly. It's not
Y = nufftn(Vs, {Is, Js})
That results in
The total number of sample points must match the number of elements in the first input argument.
Both Is and Js are nx1 arrays (as is Vs). Feeding, say, Js' isn't the trick either. I thought that maybe the answer was to reformat Vs into a matrix (similar to what is shown in the example in the help), but it's too large. In my current problem, the size of Is, Js, and Vs is in the neighborhood of 70000, so a statement like
VsExpanded = complex(zeros(NumElements, NumElements));
results in
Error using complex
Requested 72561x72561 (78.5GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become
unresponsive.
I assume that I am simply tyring to use nufftn in the wrong way. Could someone please provide a signpost on how I might correctly set up my problem?
Thank you.
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
Mike Sheffler le 1 Juin 2020
Aaaaaanybody at all?

Connectez-vous pour commenter.

### Réponse acceptée

Chris Turnes le 8 Déc 2021
If Is and Js are the coordinates of your non-uniform data, and both Is and Js have N = numel(Vs) elements, then probably what you want is
Y = nufftn(Vs, [Is(:) Js(:)]);
which will create and use an N x 2 matrix of (scattered) coordinates.
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
Mike Sheffler le 13 Déc 2021
That seems plausible. The specific thing I was working on is so far in the rear view mirror that I can't just test it out. I honestly can't remember if I tried this way or not.

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

R2020a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by