Plotting square apertures on Matlab

I want to plot the aperture of two squares that are 70 units apart(centre to centre) and each has a width of 40 units.
I have this code so far. I know that for one square at the origin then aperture=abs(x)<0.5*b I want to modify the formula I have for one square to make it fit for the two square apertures then plot it.
Is my formula for Aperture correct in the code below?
I want to be able to find the fourier transform in 2D of the aperture function
b=40.0; % Width of slit in nm
delx=100.0; % Sampling rate in nm
nx=512; % number of points
x=linspace(-nx*delx/2,(nx-2)*delx/2,nx);
[xx,yy]=meshgrid(x,x);
Aperture=(abs(x-10)< 0.5*b & abs(x-80)<0.5*b);
figure(1);
imagesc(Aperture);
axis image; colorbar;
This is what my code is giving so far, how can I fix it?

Answers (0)

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Asked:

CH
on 19 May 2021

Community Treasure Hunt

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

Start Hunting!