matlab牛顿环gif,牛顿环演示的MATLAB程序

发布时间:

Sep 23, 2013

更新时间:

Sep 23, 2013

总字数:382

阅读时间:1m

作者: 谢先斌

牛顿环演示的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');

效果

2b6d3201889e39275d1a07683803945f.png

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值