带参数的二重积分
clear all;clc;
% parameter initialisation
lambda = 514e-9;
% beam width in the x and y direction
NA=1.23;
w0 =lambda/(pi*NA);
% distance to beam waist
z=0*pi*w0^2/lambda;
k=2*pi/lambda;
= FT_init_gauss_param(lambda,1,'w0',w0,'z',z);
% Size of griddefined as +-range
xrange=8e-7;
yrange=8e-7;
% number of points of the grid
xpoints=256;
ypoints=256;
% vector to address all x and y values
x=linspace(-xrange,xrange,xpoints);
y=linspace(-yrange,yrange,ypoints);
disp('----------------------------------------------------------------------------------------');
disp(sprintf('Example 1: linear spaced grid, %dx%d points,\n range x/(2w0x)=%g, y/(2w0y)=%g\n',...
xpoints,ypoints,xrange/w0,yrange/w0));
field=FT_LG_field(gp,0,1,x,y,)+FT_LG_field(gp,1,3,x,y,)+FT_LG_field(gp,2,5,x,y,)...
+FT_LG_field(gp,3,7,x,y,)+FT_LG_field(gp,4,9,x,y,);
=meshgrid(x,y);
Z=sqrt(X.^2+Y.^2);
am=1-ones(256,256).*(Z>5e-7);
ang=angle(field);
ang=-( ang.*am); %初始相位
for p=1:5
for l=1:10
s=16e-3;
p1=0;p2=1;p3=2;p4=3;p5=4;
l1=1;l2=3;l3=5;l4=7;l5=9;
c=quad2d(quanzhongyinzi(x,y),-1.35e-3,1.35e-3,-1.35e-3,1.35e-3,'AbsTol',1e-8);
end
end
子程序是
% 自定义函数文件:quanzhongyinzi.m
function = quanzhongyinzi(p,l,x,y)
% parameter initialisation
lambda = 514e-9;
% beam width in the x and y direction
NA=1.23;
w0 =lambda/(pi*NA);
% distance to beam waist
z=0*pi*w0^2/lambda;
k=2*pi/lambda;
= FT_init_gauss_param(lambda,1,'w0',w0,'z',z);
=FT_LG_field(gp,p,l,x,y,);
ang=angle(field);
LG1=conj(field);
LG2=exp(i*ang)*LG1;
LG22=matlabFunction(LG2,'file', 'quanzhongyinzi');
提示错误是
??? Input argument "x" is undefined.
Error in ==> quanzhongyinzi at 12
=FT_LG_field(gp,p,l,x,y,);
Error in ==> xiangweiban at 46
c=quad2d(quanzhongyinzi(x,y),-1.35e-3,1.35e-3,-1.35e-3,1.35e-3,'AbsTol',1e-8);
原因可能是那个函数有4个变量,而我只要对其中x和y做二重积分。希望高手可以指点下,谢谢!
页:
[1]