what is the FFT logic in calculating far field defraction matlab implemetation

1 visualización (últimos 30 días)
Hello,there is an expression shown bellow that we need to plot in 2D grid plot as shown bellow. X and Y are 2D matrices going from -0.5 to 0.5 the Code bellow uses an FFT function FFT takes as input the func_in struct variable which has two subvariables:\ 1.the matrices which is the formula output data 2.scale variable and some n variable.
Then FFT function does some FFT2 which is described as Y = fft2(X) returns the two-dimensional Fourier transform of a matrix using a fast Fourier transform algorithm
then they do Y = fftshift(X) rearranges a Fourier transform X by shifting the zero-frequency component to the center of the array.
Then they use the sc with linspace of interval long vector.
What is the logic in the FFT matlab code?
Thanks.
Main function that uses FFT function:
L=1;
n=1024;
scale = linspace(-L/2,L/2,n);
[X , Y]= meshgrid(scale, scale);
rect=400*((sinc(10*X)).^2).*((sinc(Y)).^2).*cos(pi*3*Y./2);
func_in.mat=rect;
func_in.sc=scale;
func_out=FFT(func_in,n);
figure (1)
colormap gray
image(scale, scale, rect, 'CDataMapping','scaled');
FFT function:
function [ func_out ] = FFT( func_in,n )
func_out.mat=fftshift(fft2(func_in.mat));
interval=(func_in.sc(2)-func_in.sc(1))^-1;
func_out.sc=linspace(-interval/2,interval/2,n);% FFT creates a new scale for the output. the scale is the ratio of one over the interval of the formaer scale.
end

Respuestas (0)

Categorías

Más información sobre Fourier Analysis and Filtering en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by