yangshiganshe.m

来自「一个杨氏双孔成像干涉模拟」· M 代码 · 共 120 行

M
120
字号
% 总程序
lanmda=632.8e-6;

D=2;

L=1000;



%单色光

x=-20:0.01:20;

I=YoungIF(lanmda,D,L,x);

I=I/max(I);

subplot(2,1,1);

plot(x,I);

subplot(2,1,2);

yy=[0,1];

n=0;

for k=-20:0.01:20

    n=n+1

    line([k,k],yy,'Color',[I(n),0,0]);

end





%准单色光  5% 矩形

deltaL=lanmda*0.05;

dL=0.01*deltaL;

II=x;

II(:)=0;

for tL=(lanmda-0.5*deltaL):dL:(lanmda+0.5*deltaL)

    II=II+YoungIF(tL,D,L,x);

end

II=II/max(II);

figure;

subplot(2,1,1);

plot(x,II);

subplot(2,1,2);

n=0;

for k=-20:0.01:20

    n=n+1;

    line([k,k],yy,'Color',[II(n),0,0]);

end



    

%准单色光  10% 矩形   

deltaL=lanmda*0.1;

dL=0.01*deltaL;

II=x;

II(:)=0;

for tL=(lanmda-0.5*deltaL):dL:(lanmda+0.5*deltaL)

    II=II+YoungIF(tL,D,L,x);

end

II=II/max(II);

figure;

subplot(2,1,1);

plot(x,II);

subplot(2,1,2);

n=0;

for k=-20:0.01:20

    n=n+1;

    line([k,k],yy,'Color',[II(n),0,0]);

    hold on;

end

w=1;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?