求助大神帮忙写一个matlab程序,用来仿真单缝夫琅禾费衍射的问题,

求助大神帮忙写一个matlab程序,用来仿真单缝夫琅禾费衍射的问题,,第1张

lam=6328e-10

a=1e-3D=1

ym=3*lam*D/a

ny=51

ys=linspace(-ym,ym,ny)

np=51

yp=linspace(0,a,np)

for i=1:ny

sinphi=ys(i)/D

alpha=2*pi*yp*sinphi/lam

sumcos=sum(cos(alpha))

sumsin=sum(sin(alpha))

B(i,:)=(sumcos^2+sumsin^2)/np^2

end

N=255

Br=(B/max(B))*N

subplot(1,2,1)

image(ym,ys,Br)

colormap(gray(N))

subplot(1,2,2)

plot(B,ys)

clear

fun=@(x,z)[-(3.5+z)./((cos(x)).^2)./((1.53419*cos(x)-(cos(x)).^0.5)./(1.53419*sin(x)-(1-cos(x)).^0.5)+tan(x))]

[x,z]=ode45(fun,[0:pi/20:pi/2],[0])

format long g

[(3.5+z).*tan(x) z]

ans =

0 0

0.543838374823314 -0.0663396372208897

1.05296083819966-0.259319762982654

1.49707071346199-0.561833290275403

1.85379672440574-0.948467704299259

2.11067096535821 -1.38932903464179

2.2654381004158 -1.85406287548424

2.32504984429408 -2.31532793298911

2.30418706967978 -2.75132423725586

2.22547514345909 -3.14751936494706

7879994.07428498 -3.49999999951749


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/7925208.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-11
下一篇 2023-04-11

发表评论

登录后才能评论

评论列表(0条)

保存