牛顿环演示的MATLAB程序

发布时间: 更新时间: 总字数:610 阅读时间:2m 作者: IP上海 分享 网址
专栏文章
  1. Matlab 小球绕跑道运动
  2. Matlab 台球模拟程序 动画演示
  3. Matlab 曲柄滑块机构
  4. Matlab 卫星绕地球旋转演示动画
  5. Matlab 电影动画(Rotate Peak)
  6. Matlab 太阳 地球 月亮 绕转演示动画
  7. 牛顿环演示的MATLAB程序(当前)

牛顿环演示的MATLAB程序示例。牛顿环,又称牛顿圈,在光学上,牛顿环是一个薄膜干涉现象。 光的一种干涉图样,是一些明暗相间的同心圆环。

代码

% 牛顿环演示的MATLAB程序
close all;clear;clc;
figure('Position',[90 164 873 483]);
L=632.8;R=5;H=5;
a1=axes('Position',[0.83,0.3,0.15,0.4]);
hold on;axis([0,1,0,1]);
plot([0.25,0.25],[0.5,0.8],'k');
plot([0.5,0.5],[0.5,0.8],'k');
plot([0.75,0.75],[0.5,0.8],'k');
fill([0.22,0.25,0.27],[0.5,0.44,0.5],'k');
fill([0.47,0.5,0.52],[0.5,0.44,0.5],'k');
fill([0.72,0.75,0.77],[0.5,0.44,0.5],'k');
z=1.8exp(i(linspace(-0.21,0.21,30)-pi2))+2.1i+0.5;
fill(real(z),imag(z),'w');
rectangle('Position',[0.1,0.18,0.8,0.12]);
set(gca,'xtick',[],'ytick',[],'box','on');
% copyright zjliu
% Author's email zjliu2001@163.com
a2=axes('Position',[0.4,0.16,0.4,0.7]);
[x,y]=meshgrid(linspace(-0.005,0.005,200));
r2=(x.^2+y.^2);
Di=[2H+2(R-sqrt(R^2-r2))1e9]L;
In=abs(cos(Dipi2));
cr=abs(L-560)200;
cg=1-cr;
cb=abs(L-600)240;
Ik(,,1)=Incr;
Ik(,,2)=Incg;
Ik(,,3)=Incb;
Pc=imshow(Ik,[]);
title('the pattern of Newton''s rings','fontsize',18);
Lt=uicontrol(gcf,'style','text',...
  'unit','normalized','position',[0.06,0.86,0.21,0.06],...
  'BackgroundColor',0.7[1,1,1],'ForegroundColor',[0.8,0.1,0.9],...
  'string','波长 632.8nm','fontsize',16,'fontname','times new roman');
s1=uicontrol(gcf,'style','slider',...
  'unit','normalized','position',[0.06,0.76,0.21,0.04],...
  'BackgroundColor',0.7[1,1,1],'ForegroundColor',[0.1,0.1,0.9],...
  'SliderStep',[0.01,0.01],'value',(632.8-360)400,...
  'callback',['L=get(s1,''value'')400+360;',...
  'set(Lt,''string'',[''波长 '',num2str(L10),''nm'']);',...
  'Di=[2H+2(R-sqrt(R^2-r2))1e9]L;',...
  'In=abs(cos(Dipi2));cr=abs(L-560)200;cg=1-cr;',...
  'cb=abs(L-600)240;Ik(,,1)=Incr;Ik(,,2)=Incg;',...
  'Ik(,,3)=Incb;set(Pc,''CData'',Ik);']);
uicontrol(gcf,'style','text',...
  'unit','normalized','position',[0.04,0.81,0.08,0.04],...
  'BackgroundColor',0.8[1,1,1],'ForegroundColor',[0.1,0.1,0.9],...
  'string','360','fontsize',16,'fontname','times new roman');
uicontrol(gcf,'style','text',...
  'unit','normalized','position',[0.22,0.81,0.08,0.04],...
  'BackgroundColor',0.8[1,1,1],'ForegroundColor',[0.1,0.1,0.9],...
  'string','760','fontsize',16,'fontname','times new roman');
Rt=uicontrol(gcf,'style','text',...
  'unit','normalized','position',[0.06,0.66,0.23,0.06],...
  'BackgroundColor',0.7[1,1,1],'ForegroundColor',[0.8,0.1,0.9],...
  'string','曲率半径','fontsize',16,'fontname','times new roman');
s2=uicontrol(gcf,'style','slider',...
  'unit','normalized','position',[0.06,0.56,0.21,0.04],...
  'BackgroundColor',0.7[1,1,1],'ForegroundColor',[0.1,0.1,0.9],...
  'SliderStep',[0.01,0.01],...
  'callback',['R=get(s2,''value'')7+5;',...
  'set(Rt,''string'',[''曲率半径 5m'',num2str(R),''m'']);',...
  'Di=[2H+2(R-sqrt(R^2-r2))1e9]L;',...
  'In=abs(cos(Dipi2));cr=abs(L-560)200;cg=1-cr;',...
  'cb=abs(L-600)240;Ik(,,1)=Incr;Ik(,,2)=Incg;',...
  'Ik(,,3)=Incb;set(Pc,''CData'',Ik);']);
uicontrol(gcf,'style','text',...
  'unit','normalized','position',[0.04,0.61,0.08,0.04],...
  'BackgroundColor',0.8[1,1,1],'ForegroundColor',[0.1,0.1,0.9],...
  'string','5','fontsize',16,'fontname','times new roman');
uicontrol(gcf,'style','text',...
  'unit','normalized','position',[0.22,0.61,0.08,0.04],...
  'BackgroundColor',0.8[1,1,1],'ForegroundColor',[0.1,0.1,0.9],...
  'string','12','fontsize',16,'fontname','times new roman');
Ht=uicontrol(gcf,'style','text',...
  'unit','normalized','position',[0.06,0.46,0.23,0.06],...
  'BackgroundColor',0.7[1,1,1],'ForegroundColor',[0.8,0.1,0.9],...
  'string','气缝厚度 5nm','fontsize',16,'fontname','times new roman');
s3=uicontrol(gcf,'style','slider',...
  'unit','normalized','position',[0.06,0.36,0.21,0.04],...
  'BackgroundColor',0.7[1,1,1],'ForegroundColor',[0.1,0.1,0.9],...
  'SliderStep',[0.01,0.01],'value',0.05,...
  'callback',['H=get(s3,''value'')100;',...
  'set(Ht,''string'',[''气缝厚度 '',num2str(H),''nm'']);',...
  'Di=[2H+2(R-sqrt(R^2-r2))1e9]L;',...
  'In=abs(cos(Dipi2));cr=abs(L-560)200;cg=1-cr;',...
  'cb=abs(L-600)240;Ik(,,1)=Incr;Ik(,,2)=Incg;',...
  'Ik(,,3)=Incb;set(Pc,''CData'',Ik);']);
uicontrol(gcf,'style','text',...
  'unit','normalized','position',[0.04,0.41,0.08,0.04],...
  'BackgroundColor',0.8[1,1,1],'ForegroundColor',[0.1,0.1,0.9],...
  'string','0','fontsize',16,'fontname','times new roman');
uicontrol(gcf,'style','text',...
  'unit','normalized','position',[0.22,0.41,0.08,0.04],...
  'BackgroundColor',0.8[1,1,1],'ForegroundColor',[0.1,0.1,0.9],...
  'string','100','fontsize',16,'fontname','times new roman');
%%%% Note
uicontrol(gcf,'style','text',...
  'unit','normalized','position',[0.05,0.08,0.68,0.07],...
  'BackgroundColor',0.8[1,1,1],'ForegroundColor',[0.8,0.2,0.2],...
  'string','颜色和波长的关系可能不准确,我只是根据大致的关系写的',...
  'fontsize',16,'fontname','times new roman');
uicontrol(gcf,'style','text',...
  'unit','normalized','position',[0.05,0.02,0.6,0.07],...
  'BackgroundColor',0.8[1,1,1],'ForegroundColor',[0.9,0.2,0.5],...
  'string','仅供参考:qq 10972072',...
'fontsize',16,'fontname','times new roman');

效果

牛顿环演示的MATLAB程序

Home Archives Categories Tags Statistics
本文总阅读量 次 本站总访问量 次 本站总访客数