MATLAB Simulation of Fraunhofer Diffraction

In summary: And another question: if the wavelength is one unit length in my program, can I simulate an aperture with diameter less than one wavelength?
  • #1
wybmax
7
0
Hello, I am using MATLAB to simulate a Fraunhofer diffraction pattern for a given aperture, but I have a little question. Hope someone can help.

Sorry I am just a high school student and does not completely understand all mathematic deductions about Fraunhofer Diffraction on Wikipedia. I simply learn the way to generate the diffraction pattern: use a matrix of 0 and 1 to describe the aperture, take the Fast Fourier Transform of the matrix, "fftshift" it, display the transformed image to an image, and I get the diffraction.

I made programs for 1-dimensional and 2-dimensional apertures, and the diffraction looks well. But it seems that the diffraction pattern simulated in this way is independent of the frequency (or wavelength) of the incident light. i.e., as long as I get an aperture, I get an only diffraction pattern regardless of the wavelength of the light, because there are no light properties described in my program. In reality that is not the case: for example the wavelength of light determines the distance between two fringes in the double-slit diffraction; for the same double-slit, the shorter the wavelength, the finer the fringes of diffraction pattern.

Well, how can I put wavelength into consideration when I simulate the diffraction?

Thanks.
 
Physics news on Phys.org
  • #2
The wave length is related to the size of the aperture. For shorter wave lengths, you need a smaller aperture to produce the same result. Thus, since this is numerical, the unit length of your program is likely to be one wavelength of the light (or similar, I have not seen your program). The wavelength is then by definition 1. You could simulate other wavelengths by scaling the aperture.
 
  • #3
Orodruin said:
The wave length is related to the size of the aperture. For shorter wave lengths, you need a smaller aperture to produce the same result. Thus, since this is numerical, the unit length of your program is likely to be one wavelength of the light (or similar, I have not seen your program). The wavelength is then by definition 1. You could simulate other wavelengths by scaling the aperture.

Thanks for your explanation. I will add my 1-dimensional diffraction pattern program and the result for your reference.

And another question: if the wavelength is one unit length in my program, can I simulate an aperture with diameter less than one wavelength? For example, if I want to create a single-slit of 0.5 times wavelength, I cannot split one number in a matrix into two.

Thanks.

-------------MY PROGRAM-----------------
%%% initialize a piecewise function describing the aperture,
%%% then using fft2 to simulate the diffraction pattern.

clear;clc

x=-30:0.1:30; % domain
num=size(x,2);
for i=1:1:num % set initial values for aperture; here is a double-slit
if x(i)<2.5 && x(i)>1.5
y(i)=1;
else
if x(i)<-1.5 && x(i)>-2.5
y(i)=1;
else
y(i)=0;
end
end
end
subplot(3,1,1);
plot(x,y);xlabel('aperture function');
subplot(3,1,2);
imagesc(y);xlabel('aperature for diffraction');

fourier=fft(y); % create diffraction pattern
fourier=fftshift(fourier);
fourier_abs=abs(fourier); % get the intensity of diffraction for display
fourier_abs=mat2gray(fourier_abs);

subplot(3,1,3);
imagesc(fourier_abs);xlabel('diffraction pattern using fft2');

------------------------
The attachment is my screen shot of my program.
 

Attachments

  • ???? 2014-06-29 14.56.40.png
    ???? 2014-06-29 14.56.40.png
    8 KB · Views: 2,055
  • #4
As you show in your subplot(3,1,1), your aperture y(x) is a function of x. However, in your subplot(3,1,3), you're just plotting the Fourier coefficients without specifying any units for your horizontal axis.

When you Fourier transform, you get a function of "something else" which in this case is k sin θ, where the wavenumber k = 2π/λ for wavelength λ and θ is the angle with respect to the axis. (For angles close to the axis, or small θ, you can approximate k sin θ ≈ kθ.)

If you go back and plot the Fourier transform with respect to the proper horizontal units, then the dependence on k (or λ) will reappear. By the way, what this will tells you is that the diffraction pattern never changes shape — it just scales with the wavenumber (inversely with the wavelength) of the incident light.
 
  • #5
olivermsun said:
If you go back and plot the Fourier transform with respect to the proper horizontal units, then the dependence on k (or λ) will reappear.

I generally got what you means. Could you please explain more about how to plot the FT respect to proper units in my program? Thanks.
 
  • #6
Well, suppose you take have a set of N inputs y(x1), y(x2), …, y(xN) at a set of points x1, …, xN. The spacing between the xn's is fs. This part is easy— you know how to plot y vs. x.

Now you do an FFT on y1, …, yN and get a set of N outputs, Y1, …, YN.

The Yn correspond to a set of (spatial) frequencies k1, …, kN, with spacing dk. Do you know how to find dk and get the set of frequencies?
 
  • Like
Likes 1 person
  • #7
olivermsun said:
Well, suppose you take have a set of N inputs y(x1), y(x2), …, y(xN) at a set of points x1, …, xN. The spacing between the xn's is fs. This part is easy— you know how to plot y vs. x.

Now you do an FFT on y1, …, yN and get a set of N outputs, Y1, …, YN.

The Yn correspond to a set of (spatial) frequencies k1, …, kN, with spacing dk. Do you know how to find dk and get the set of frequencies?

As this program is a numerical simulation without any physical units, I think we can just assume the spacing (dk) to be 1 unit. I can also change it according to different sampling rate of the object. In this case the wavelength may also be a number related to the 'unit' defined above, not to our normal unit like 'nanometer'.

Also, I have to know the angle θ to calculate the independent variable of Fourier transformed function. Do I have to get the distance between the object and the screen? Or is there a way of approximation in Fraunhofer diffraction?

Thanks.
 
  • #8
As formulated, your 'x' units are indeed in "wavelengths" (times some constant).

The angle is independent of the distance between object and screen, but of course the size of the pattern on the screen will get bigger as the distance gets bigger.
 

1. What is MATLAB simulation of Fraunhofer diffraction?

MATLAB simulation of Fraunhofer diffraction is a computational method used to model the diffraction pattern produced by a slit or aperture. It involves using MATLAB software to simulate the diffraction pattern based on the principles of Fraunhofer diffraction, which is a type of wave interference phenomenon.

2. How does MATLAB simulate Fraunhofer diffraction?

MATLAB simulates Fraunhofer diffraction by using the Fresnel-Kirchhoff diffraction formula, which takes into account the diffraction pattern produced by a slit or aperture. The formula is implemented in MATLAB code, and the simulation is carried out by varying parameters such as slit width, aperture size, and wavelength of the incident light.

3. What are the advantages of using MATLAB for Fraunhofer diffraction simulation?

One of the main advantages of using MATLAB for Fraunhofer diffraction simulation is its flexibility and ease of use. MATLAB allows for quick and easy manipulation of parameters, making it ideal for experimentation and analysis. Additionally, MATLAB has built-in functions for handling complex mathematical operations, making it a powerful tool for simulating diffraction patterns.

4. Can MATLAB simulation of Fraunhofer diffraction be used for other types of diffraction?

Yes, MATLAB simulation of Fraunhofer diffraction can also be used for other types of diffraction, such as double-slit diffraction or diffraction through a grating. The principles of diffraction are the same, so the same simulation methods can be applied with slight modifications to the parameters and equations used.

5. Are there any limitations to MATLAB simulation of Fraunhofer diffraction?

One limitation of MATLAB simulation of Fraunhofer diffraction is that it does not take into account the effects of non-ideal conditions, such as the finite size of the slit or aperture. Additionally, the simulation is based on the assumption of a single wavelength of incident light, which may not be the case in real-world scenarios. Therefore, the results of the simulation should be interpreted with these limitations in mind.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Replies
5
Views
843
  • Introductory Physics Homework Help
Replies
11
Views
1K
  • Introductory Physics Homework Help
Replies
34
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
5K
  • Advanced Physics Homework Help
Replies
2
Views
1K
  • Advanced Physics Homework Help
2
Replies
50
Views
4K
Back
Top