马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
下面是myfun.m
function result = myfun(x,h,A,d,r,fai)
result =(((h+A*cos(x)*sin(fai)).^2).*(h^2+A^2+d^2+r^2+2*A*cos(x)*(h*sin(fai)-d*cos(fai))))./(((h^2+A^2+d^2+r^2+2*A*(h*sin(fai)-d*cos(fai))*cos(x))).^2-4*r^2*(d^2+A^2*(1-sin(fai)^2*cos(x).^2)-2*d*A*cos(fai)*cos(x))).^3/2;
end
下面是sjcll.m
i=1;
d=0.15;fai=pi/6;r=0.04;
for h=0.116:0.001:0.116
result = [];
for A1 = 0:0.0005:0.05
temp= quad(@myfun,0,pi,[],0,h,A1,r,d,fai); % 0~pi积分区间
result = [result,temp];
end
jie(i,:)=result;%把每次所得结果存成矩阵
i=i+1;
end
A=0:0.0005:0.05;
for n=1:i-1
plot(A,jie(n,:)/jie(n,1),'g.','Markersize',6)
hold on
end
xlabel('A');ylabel('result');%标坐标
h1=0.05;
for j=1:i-1
hh(j,1:length(A))=h1;
h1=h1+0.01;
end
figure
for m=1:i-1
plot3(A,hh(m,:),jie(m,:),'r.','Markersize',6)
hold on
end
xlabel('A');ylabel('h');zlabel('result');
上面的m文件对r的处理是赋值0.04,现在我想把原先的函数对x积分后再对r积分。积分范围从0.04到0.05.
试着将temp= quad(@myfun,0,pi,[],0,h,A1,r,d,fai); % 0~pi积分区间
改为: temp= dblquad(@myfun,0,pi,0.04,0.05,[],0,h,A1,d,fai); % 0~pi积分区间
可是运行一下,却发现行不通。
下面是报错的内容:
??? Error using ==> fcnchk
FUN must be a function, a valid string expression,
or an inline function object.
Error in ==> dblquad at 52
quadf = fcnchk(quadf);
Error in ==> sjcll at 6
temp= dblquad(@myfun,0,pi,0.04,0.05,[],0,h,A1,d,fai); % 0~pi积分区间
现在我是厚着脸皮来请教了。请多多包含。谢谢 |