计算量不小 区间不宜过大
zlabel('f5')
title('f5')
......................
...........................
matlab求二重积分
g = @(x,y)
1.*((x-2.5).^2+(y-1).^2<=1)+0.*((x-2.5).^2+(y-1).^2>1);
f = @(x,y)
1.*((x-2).^2+(y-1).^2<=1)+0.*((x-2).^2+(y-1).^2>1);
z = @(x,y) f(x,y)+g(x,y)
Q = dblquad(z,0,4,-1,3)
...........
% 以下代码在7.1版以上均可运行。
r=1;
a=2; % 输入a的值
Phi=3; % 输入Phi的值
f1 = @(Theta_2,Phi_2) sin(Theta_2).*sin(Theta_2).*cos(Phi_2);
f2 = @(Theta_2,Phi_2) sqrt(r^2+a^2-2*r*a.*sin(Theta_2).*cos(Phi-Phi_2));
f3 = @(Theta_2,Phi_2) f1(Theta_2,Phi_2)./f2(Theta_2,Phi_2);
f5 = dblquad(f3,0,pi,0,pi)
......................
...........................
..................
dblquad-
Numerically evaluate double
integral over rectangle
Syntax
q = dblquad(fun,xmin,xmax,ymin,ymax)
q = dblquad(fun,xmin,xmax,ymin,ymax,tol)
q = dblquad(fun,xmin,xmax,ymin,ymax,tol,method)
Description
q = dblquad(fun,xmin,xmax,ymin,ymax)
callsthe quad
function to evaluatethe double integral fun(x,y) over the
rectangle xmin<= x <= xmax,
ymin <=y <= ymax.
fun isa function handle. See Function
Handles in the MATLAB Programming documentationfor more
information. fun(x,y) must accept a vector x anda
scalar y and return a vector of values of
theintegrand.
Parameterizing
Functions, in the MATLAB Mathematicsdocumentation, explains how
to provide additional paramet