|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
谁能帮我看看我的程序该如何改进,问题主要集中在 beessel函数中含有未知数,最后求g的积分用求和代替不知是否合理?
公式不知如何贴上来,上传了一个word文件,谢谢各位:)
程序如下:
Ellipsoid.m
function y=ellipsoid(x)
function f=f(m)
nhb=1.4;
npl=1.33;
t=1.3;
k=2.*pi./t;
r=sin(x);
a=3.9;
b=3.9;
c=10;
A=(a.*b).^0.5;
aa=(2.*pi.*npl./t).*A;
f=aa.^2.*(1-exp(-2.*i.*k.*c.*(nhb-npl).*sin(m))).*BESSELJ(0,a.*r.*cos(m)).*cos(m).*sin(m);
end
y=abs(quad(@f,0,pi./2)).^2.*cos(x).*sin(x);
end
Ellipsoid1.m
function y1=sphere1(x)
function f=f(r,m)
nhb=1.4;
npl=1.33;
t=1.3;
k=2.*pi./t;
a=b=3.9;
A=(a.*b).^0.5;
aa=(2.*pi.*npl./t).*A;
c=10;
r=sin(x);
f=aa.^2.*(1-exp(-2.*i.*k.*c.*(nhb-npl).*sin(m))).*BESSELJ(0,aa.*r.*cos(m)).*sin(m).*cos(m);
end
y1=abs(quad(@f,0,pi./2)).^2.*sin(x);
end
clear all
x=0:0.2:pi;
ge.m
for ii=1:length(x)
y(ii)=ellipsoid(x(ii));
y1(ii)=ellipsoid1(x(ii));
end
g1=sum(y(ii))
g2=sum(y1(ii))
gm=g1./g2
错误:
??? Input argument "m" is undefined.
Error in ==> ellipsoid>f at 20
f=aa.^2.*(1-exp(-2.*i.*k.*c.*(nhb-npl).*sin(m))).*BESSELJ(0,a.*r.*cos(m)).*cos(m).*sin(m);
Error in ==> quad at 62
y = f(x, varargin{:});
Error in ==> ellipsoid at 22
y=abs(quad(@f,0,pi./2)).^2.*cos(x).*sin(x);
Error in ==> ge at 6
y(ii)=ellipsoid(x(ii)); |
|