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

7 次查看(过去 30 天)
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.

采纳的回答

Chris Turnes
Chris Turnes 2021-12-8
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 个评论
Mike Sheffler
Mike Sheffler 2021-12-13
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by