what is the FFT logic in calculating far field defraction matlab implemetation
11 views (last 30 days)
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?
Main function that uses FFT function:
scale = linspace(-L/2,L/2,n);
[X , Y]= meshgrid(scale, scale);
image(scale, scale, rect, 'CDataMapping','scaled');
function [ func_out ] = FFT( func_in,n )
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.