0
点赞
收藏
分享

微信扫一扫

【光学】基于Matlab模拟衍射光栅实验

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

​​智能优化算法​​​  ​​神经网络预测​​​ ​​雷达通信 ​​​ ​​无线传感器​​

​​信号处理​​​ ​​图像处理​​​ ​​路径规划​​​ ​​元胞自动机​​​ ​​无人机​​

⛄ 内容介绍

开放式虚拟仿真实验教学是当前教育信息化的一种有效体现.学生可以通过虚拟仿真在网络平台实现在线操作,开展实验测试,记录数据,完成测试题等,虽然无法接触到实验设备,但是同样可以完成实验操作,实现实验类课程的网络学习模式.建设大学物理实验虚拟仿真网络平台,需要配套大量的物理实验课程资源,其中基于MATLAB的实验仿真设计与分析是大学物理实验资源库建设的重要方面.本文为基于MATLAB的光栅衍射实验仿真设计与分析,通过MATLAB软件仿真光栅衍射实验不仅能够加深学生对光栅衍射原理的理解,在提升教学质量的同时,也能够进一步完善大学物理虚拟仿真网络平台资源库建设,真正实现大学物理实验的虚拟仿真网络教学和线下教学的有机融合.

⛄ 部分代码

% Diffraction grating with monochromatic incident beam, with a single selected 

% order shown. Cross section of the geometry of a diffraction grating, a common

% illustration in textbooks of optics, spectroscopy, and analytical chemistry.

% The grating surface is at the bottom of the diagram, along the x axis.

% The line labeled "Incident beam" is the direction of the incoming light

% beam.  The dotted line is the diffracted (outgoing) beam. The line  

% labeled "Order 0" is the direction of the zeroth-order diffraction, 

% at the angle of specular reflection from the grating surface.   

% The upper left slider controls the angle of incidence, the lower 

% left slider controls the grating ruling density (lines/mm),

% the upper right slider controls the order, and the lower right

% slider controls the wavelength of the incident beam.

% incident beam.

% Calls GratingOrder1, GratingOrder2, GratingOrder3, and GratingOrder4 as  

% functions when sliders are adjusted.

% Tom O'Haver, toh@umd.edu, July 2006

% Slider function by Matthew Jones.


global alphar

global angle0

global d

global lambda

global m


% User-modifiable parameters:

lambda = 500; %  Initial wavelength 

alphar = 1;   %  Initial value of angle of incidence

R=45;       %  Initial value of Grating Ruling density, lines/mm,

d=1000000/R;  %  Initial value of Groove spacing, in mn

m=80;          % Initial value of Diffraction Order 


close

figure(1);

clf

h=figure(1);

r=pi/2; % Constant used below


% Compute the angle of the zero-order beam and the X and Y coordinates for

% the endoint of the incident and zero-order beams. 

xi=-cos(r-alphar);yi=sin(r-alphar); % Incident beam

angle0 = asin(-sin(alphar));x0=-cos(r-angle0);y0=sin(r-angle0); % Zero order


% Compute the angle of the diffracted beam and the X and Y coordinates for

% its endpoint if the angle is on scale (90 degrees or less)

angle1 = asin(m*lambda/d-sin(alphar));if imag(angle1)==0;x1=-cos(r-angle1);y1=sin(r-angle1);else x1=0;y1=0;end;


% Draw line from 0,0 to the endpoint

plot([0 xi],[0 yi],'k',[0 x0],[0 y0],'k--',[0 x1],[0 y1],'k:')


% Compute and display the angular dispersion

AngularDispersison=asin(m*(lambda+1)/d-sin(alphar))-asin(m*lambda/d-sin(alphar));

text(-.4,1.4,['Angular Dispersion = '  num2str(AngularDispersison*360/(2*pi)) ' degrees/nm']);


% Add labels and title

text(xi,yi,'Incident beam');

if imag(angle0)==0;text(x0/2,y0/2,'Order 0');end;

if imag(angle1)==0;text(x1,y1,['Order ' num2str(m)]);end;

% Note: when the wavelength is adjusted, the order label is replaced with

% the wavelength.

title('Diffraction grating with monochromatic incident beam, single selected order shown.');

xlabel(['Angle = ' num2str(round(alphar*360/(2*pi))) ' degrees.   Wavelength = '  num2str(round(lambda)) ' nm.  Lines/mm = ' num2str(round(1000000/d)) '   Order = ' num2str(m)])


h2=gca;axis([-1 1 0 1.5]);


% Draw the sliders

rtslid(h,@GratingOrder1,h2,1,'Scale',[0 pi/2],'Def',alphar,'Back',[0.9 0.9 0.9],'Label','Angle','Position',[0.03 0.5 0.03 0.35]);

rtslid(h,@GratingOrder2,h2,0,'Scale',[0 1000],'Def',lambda,'Back',[0.9 0.9 0.9],'Label','Wavelength','Position',[0.95 0.05 0.03 0.35]);

rtslid(h,@GratingOrder3,h2,0,'Scale',[0 600],'Def',R,'Back',[0.9 0.9 0.9],'Label','Lines/mm','Position',[0.03 0.05 0.03 0.35]);

rtslid(h,@GratingOrder4,h2,0,'Scale',[0 150],'Def',m,'Back',[0.9 0.9 0.9],'Label','Order','Position',[0.95 0.5 0.03 0.35]);

⛄ 运行结果

【光学】基于Matlab模拟衍射光栅实验_ide

【光学】基于Matlab模拟衍射光栅实验_资源库_02

⛄ 参考文献

[1]史建新等. "基于MATLAB的光栅衍射实验仿真设计与分析." (2021).

[2]李松柏, 吴加贵, 卢孟春,等. 基于MATLAB的光栅衍射实验仿真与研究[J]. 西南民族大学学报:自然科学版, 2010(5):8.

❤️ 关注我领取海量matlab电子书和数学建模资料
❤️部分理论引用网络文献,若有侵权联系博主删除


举报

相关推荐

0 条评论