Matlab积分问题?Function 'eval' is not defined for values of class 'double'.Lamda=1550e-9;R=3e-3;F=1;C=1/(i*Lamda);k=2*pi/Lamda;syms m n r1 a1; r2=linspace(0,27e-3,1000); %屏上半径a2=linspace(0,360,3600); %角度微分E=zeros(1000,3600);E1=E;E

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/24 18:50:22
Matlab积分问题?Function''eval''isnotdefinedforvaluesofclass''double''.Lamda=1550e-9;R=3e-3;F=1;C=1/(i*Lamda)

Matlab积分问题?Function 'eval' is not defined for values of class 'double'.Lamda=1550e-9;R=3e-3;F=1;C=1/(i*Lamda);k=2*pi/Lamda;syms m n r1 a1; r2=linspace(0,27e-3,1000); %屏上半径a2=linspace(0,360,3600); %角度微分E=zeros(1000,3600);E1=E;E
Matlab积分问题?Function 'eval' is not defined for values of class 'double'.
Lamda=1550e-9;
R=3e-3;
F=1;
C=1/(i*Lamda);
k=2*pi/Lamda;
syms m n r1 a1;
r2=linspace(0,27e-3,1000); %屏上半径
a2=linspace(0,360,3600); %角度微分
E=zeros(1000,3600);
E1=E;E2=E;
for m=1:1000;
for n=1:3600;
E1(m,n)=double(int((int(cos(r1*cos(a1)/F*r2(m)*cos(a2(n))+r1*sin(a1)/F*r2(m)*sin(a2(n)))*exp(r1^2/(2/R^2))*r1,r1,0,3e-3)),a1,0,360));
E2(m,n)=double(int((int(-i*sin(r1*cos(a1)/F*r2(m)*cos(a2(n))+r1*sin(a1)/F*r2(m)*sin(a2(n)))*exp(r1^2/(2/R^2))*r1,r1,0,3e-3)),a1,0,360));
E(m,n)=(E1(m,n)+E2(m,n))*C/F*exp(i*k*F)*exp(i*k*r2(m)/(2*F));
end
end
imshow(E^2*255);
提示的错误信息是:
Function 'eval' is not defined for values of class 'double'.
Error in ==> eval at 44
[varargout{1:nargout}] = builtin('eval',varargin{:});
Error in ==> sym.double at 45
D = reshape(eval(X),siz);

Matlab积分问题?Function 'eval' is not defined for values of class 'double'.Lamda=1550e-9;R=3e-3;F=1;C=1/(i*Lamda);k=2*pi/Lamda;syms m n r1 a1; r2=linspace(0,27e-3,1000); %屏上半径a2=linspace(0,360,3600); %角度微分E=zeros(1000,3600);E1=E;E
出错在E1赋值时用了double转换,但你定义的a1就一符号,你让matlab怎么帮你把它转成数值?