资源描述:
《matlab多重积分.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、tic;f1=quadl(@(y)2*y.*exp(-y.^2).*arrayfun(@(y)quadl(@(x)exp(-x.^2)./(y.^2+x.^2),-1,1),y).^2,0.2,1),toctic;f1=quadl(@(y)2*y.*exp(-y.^2).*arrayfun(@(y)quadl(@(x)exp(-x.^2)./(y.^2+x.^2),-1,1),y).^2,0.1,1),tocf1= 10.213463739161501Elapsedtimeis0.056856seconds.f1= 19.8685264127619
2、02Elapsedtimeis0.245491seconds.>>tic;f1=quadl(@(y)2*y.*exp(-y.^2).*arrayfun(@(y)quadl(@(x)exp(-x.^2)./(y.^2+x.^2),-1,1),y).^2,0.01,1),tocf1= 61.334993990451785Elapsedtimeis1.103514seconds.>>tic;f1=quadl(@(y)2*y.*exp(-y.^2).*arrayfun(@(y)quadl(@(x)exp(-x.^2)./(y.^2+x.^2),-1,1),y
3、).^2,0.001,1),tocf1= 1.063674743047246e+002Elapsedtimeis2.785133seconds.>>tic;f1=quadl(@(y)2*y.*exp(-y.^2).*arrayfun(@(y)quadl(@(x)exp(-x.^2)./(y.^2+x.^2),-1,1),y).^2,0.0001,1),tocf1= 1.517765989598245e+002Elapsedtimeis5.657963seconds.精度设为1e-10,重新算了下:耗时明显增加tic;f1=quadl(@(y)2*y
4、.*exp(-y.^2).*arrayfun(@(y)quadl(@(x)exp(-x.^2)./(y.^2+x.^2),-1,1),y).^2,0.2,1,1e-10),tocf1= 10.213463738922437Elapsedtimeis0.251798seconds.>>tic;f1=quadl(@(y)2*y.*exp(-y.^2).*arrayfun(@(y)quadl(@(x)exp(-x.^2)./(y.^2+x.^2),-1,1),y).^2,0.1,1,1e-10),tocf1= 19.868526415332266Elap
5、sedtimeis0.888888seconds.(NB,第一次算出这样的时间,哈哈:P)>>tic;f1=quadl(@(y)2*y.*exp(-y.^2).*arrayfun(@(y)quadl(@(x)exp(-x.^2)./(y.^2+x.^2),-1,1),y).^2,0.01,1,1e-10),tocf1= 61.334993966628041Elapsedtimeis4.295050seconds.>>tic;f1=quadl(@(y)2*y.*exp(-y.^2).*arrayfun(@(y)quadl(@(x)exp(-x.^2).
6、/(y.^2+x.^2),-1,1),y).^2,0.001,1,1e-10),tocf1= 1.063674742766796e+002Elapsedtimeis10.851554seconds.>>tic;f1=quadl(@(y)2*y.*exp(-y.^2).*arrayfun(@(y)quadl(@(x)exp(-x.^2)./(y.^2+x.^2),-1,1),y).^2,0.0001,1,1e-10),tocf1= 1.517765989315576e+002Elapsedtimeis22.210441seconds.用matlab进
7、行三重积分:tic;quadl(@(x)arrayfun(@(xx)quad2d(@(y,z)xx.*y.*z,xx,2*xx,@(y)xx*y,@(y)2*xx*y),x),1,2),toctic;quad2d(@(x,y)arrayfun(@(xx,yy)quadl(@(z)xx.*yy.*z,xx*yy,2*xx*yy),x,y),1,2,@(x)x,@(x)2*x),toctic;quadl(@(x)arrayfun(@(xx)quadl(@(y)arrayfun(@(yy)quadl(@(z)xx.*yy.*z,xx*yy,2*xx*yy),
8、y),xx,2*xx),x),1,2),toctic;triplequad(@(x,y,z)x