% 牛顿环演示的MATLAB程序
close all;clear;clc;
figure('Position',[90 164 873 483]);
L=6328;R=5;H=5;
a1=axes('Position',[083,03,015,04]);
hold on;axis([0,1,0,1]);
plot([025,025],[05,08],'k');
plot([05,05],[05,08],'k');
plot([075,075],[05,08],'k');
fill([022,025,027],[05,044,05],'k');
fill([047,05,052],[05,044,05],'k');
fill([072,075,077],[05,044,05],'k');
z=18exp(i(linspace(-021,021,30)-pi/2))+21i+05;
fill(real(z),imag(z),'w');
rectangle('Position',[01,018,08,012]);
set(gca,'xtick',[],'ytick',[],'box','on');
% \copyright: zjliu
% Author's email: zjliu2001@163com
a2=axes('Position',[04,016,04,07]);
[x,y]=meshgrid(linspace(-0005,0005,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',[006,086,021,006],
'BackgroundColor',07[1,1,1],'ForegroundColor',[08,01,09],
'string','波长: 6328nm','fontsize',16,'fontname','times new roman');
s1=uicontrol(gcf,'style','slider',
'unit','normalized','position',[006,076,021,004],
'BackgroundColor',07[1,1,1],'ForegroundColor',[01,01,09],
'SliderStep',[001,001],'value',(6328-360)/400,
'callback',['L=get(s1,''value'')400+360;',
'set(Lt,''string'',[''波长: '',num2str(L/10),''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',[004,081,008,004],
'BackgroundColor',08[1,1,1],'ForegroundColor',[01,01,09],
'string','360','fontsize',16,'fontname','times new roman');
uicontrol(gcf,'style','text',
'unit','normalized','position',[022,081,008,004],
'BackgroundColor',08[1,1,1],'ForegroundColor',[01,01,09],
'string','760','fontsize',16,'fontname','times new roman');
Rt=uicontrol(gcf,'style','text',
'unit','normalized','position',[006,066,023,006],
'BackgroundColor',07[1,1,1],'ForegroundColor',[08,01,09],
'string','曲率半径:','fontsize',16,'fontname','times new roman');
s2=uicontrol(gcf,'style','slider',
'unit','normalized','position',[006,056,021,004],
'BackgroundColor',07[1,1,1],'ForegroundColor',[01,01,09],
'SliderStep',[001,001],
'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',[004,061,008,004],
'BackgroundColor',08[1,1,1],'ForegroundColor',[01,01,09],
'string','5','fontsize',16,'fontname','times new roman');
uicontrol(gcf,'style','text',
'unit','normalized','position',[022,061,008,004],
'BackgroundColor',08[1,1,1],'ForegroundColor',[01,01,09],
'string','12','fontsize',16,'fontname','times new roman');
Ht=uicontrol(gcf,'style','text',
'unit','normalized','position',[006,046,023,006],
'BackgroundColor',07[1,1,1],'ForegroundColor',[08,01,09],
'string','气缝厚度: 5nm','fontsize',16,'fontname','times new roman');
s3=uicontrol(gcf,'style','slider',
'unit','normalized','position',[006,036,021,004],
'BackgroundColor',07[1,1,1],'ForegroundColor',[01,01,09],
'SliderStep',[001,001],'value',005,
'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',[004,041,008,004],
'BackgroundColor',08[1,1,1],'ForegroundColor',[01,01,09],
'string','0','fontsize',16,'fontname','times new roman');
uicontrol(gcf,'style','text',
'unit','normalized','position',[022,041,008,004],
'BackgroundColor',08[1,1,1],'ForegroundColor',[01,01,09],
'string','100','fontsize',16,'fontname','times new roman');
%%%% Note
uicontrol(gcf,'style','text',
'unit','normalized','position',[005,008,068,007],
'BackgroundColor',08[1,1,1],'ForegroundColor',[08,02,02],
'string','颜色和波长的关系可能不准确,我只是根据大致的关系写的',
'fontsize',16,'fontname','times new roman');
uicontrol(gcf,'style','text',
'unit','normalized','position',[005,002,06,007],
'BackgroundColor',08[1,1,1],'ForegroundColor',[09,02,05],
'string','\Copyright zjliu, email: zjliu2001@163com',
'fontsize',16,'fontname','times new roman');
实现方法:使用matlab内置的绘制椭球的函数 ellipsoid(xc,yc,zc,xr,yr,zr,n),其中:
xc,yc,zc分别表示椭球中心的x,y,z坐标。
xr,yr,zr分别表示椭球x,y,z半轴的长度。
n表示绘图时,沿着经度和纬度方向划分的曲面片数量,n越大则数据越密集,曲面越光滑。
下面进行实例演示:绘制一个中心在原点,三个半轴分别为10,5,5的椭球
1、打开matlab软件,在命令行窗口输入:ellipsoid(0,0,0,10,5,5,50)
向左转|向右转
2、显示结果如下图所示:
向左转|向右转
axis([-6 6 -6 6],'equal','manual');hold on;
ezplot('x^2+y^2-9');
h=ezplot('x^2+y^2-1');
x=get(h,'xdata');
y=get(h,'ydata');
for t=1:3600
set(h,'xdata',x+4cosd(t),'ydata',y+4sind(t));
drawnow;
end
以上就是关于matlab牛顿迭代动画演示全部的内容,包括:matlab牛顿迭代动画演示、matlab做椭球体自转的动画效果、用matlab主程序文件产生动画:呈现一小圆(半径为1)在一大圆(半径为3)的圆周外部滚动的动画,要求连续等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)