Matlab积分问题?Function 'eval' is not defined for values of clas
来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/08/08 07:47:02
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);
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 clas](/uploads/image/z/3732906-66-6.jpg?t=Matlab%E7%A7%AF%E5%88%86%E9%97%AE%E9%A2%98%3FFunction+%27eval%27+is+not+defined+for+values+of+clas)
出错在E1赋值时用了double转换,但你定义的a1就一符号,你让matlab怎么帮你把它转成数值?
再问: a1定义的不是一维矩阵么?我把double去掉了没有报错但是没有计算结果。
我现在改成了不用int来做积分,直接用循环累加来计算积分了,已经解决问题了。
还是谢谢你!
再问: a1定义的不是一维矩阵么?我把double去掉了没有报错但是没有计算结果。
我现在改成了不用int来做积分,直接用循环累加来计算积分了,已经解决问题了。
还是谢谢你!
Matlab积分问题?Function 'eval' is not defined for values of clas
Matlab里大于号怎么用?为什么出现错误Function '>' is not defined for values
英语翻译For all positive values of x,the function f is defined b
matlab中function和end问题,错误提示This statement is not inside any f
MATLAB function的问题- -
SAT数学思路f(x)=kg(x)+2The function above is defined in terms of
matlab问题 MATLAB Toolbox Path Cache is out of date and is not
matlab进行数值积分时出现 Reached the maximum number of function evalu
several values of the function f are shown. the function g i
for which of the following function f is f^-1 a function
英语翻译That this is the result of structure and not of values i
matlab eval函数中变量