Fourier transform values at non-integer frequencies for images.
7 次查看(过去 30 天)
显示 更早的评论
For one of my projects I need Fourier transform values at non-integer frequencies of images. Zero padding doesn't help for my application. I'm trying to use nufftn without specifying sample points i.e., nufft(X, [], f). But I couldn't quite understand the output. Documentation is not elaborate enough. I really appreciate if anyone can help me with this. Thanks in Advance.
0 个评论
回答(1 个)
Sudarsanan A K
2024-3-18
Hello Saivivek,
The "nufftn" function in MATLAB is used for non-uniform fast Fourier transforms. It allows you to compute the Fourier transform at non-integer frequencies for non-uniformly sampled data.
To use "nufftn" without specifying sample points, you can pass an empty array as the second argument. For example,
nufftn(X, [], f)
will compute the Fourier transform of the data "X" at the frequencies specified by the vector "f".
The output of "nufftn" will be a vector or array of complex numbers representing the Fourier transform values at the specified frequencies. The size and shape of the output will depend on the size and shape of the input data "X" and the frequencies "f".
Here is an example:
% Assuming img is your image data
img = double('cameraman.tif'); % Convert image to double
% Define non-integer frequencies for 2D image
frequencies = [0.1, 0.2; 0.3, 0.4; 0.45, -0.45]; % Example frequency pairs
% Compute the Fourier transform at specified non-integer frequencies
F = nufftn(img, [], frequencies);
% F now contains the Fourier transform values at the specified frequencies
For better interpretation of the output, it may be helpful to visualize the results using MATLAB's plotting functions. For example, you can plot the magnitude and phase of the Fourier transform values to get a better understanding of the frequency content of your data:
% Compute magnitude and phase
magnitude = abs(F);
phase = angle(F);
% Plot magnitude
figure;
stem3(frequencies(:,1), frequencies(:,2), magnitude, 'filled');
title('Magnitude Spectrum');
xlabel('Frequency X');
ylabel('Frequency Y');
zlabel('Magnitude');
% Plot phase
figure;
stem3(frequencies(:,1), frequencies(:,2), phase, 'filled');
title('Phase Spectrum');
xlabel('Frequency X');
ylabel('Frequency Y');
zlabel('Phase');
For more information about the "nufftn" and its different use-cases, refer to the documentation:
I hope this helps!
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!