Fourier transform values at non-integer frequencies for images.

8 Ansichten (letzte 30 Tage)
Saivivek
Saivivek am 12 Mär. 2024
Kommentiert: Saivivek am 20 Mär. 2024
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.

Antworten (1)

Sudarsanan A K
Sudarsanan A K am 18 Mär. 2024
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!

Kategorien

Mehr zu Fourier Analysis and Filtering finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by