I am trying too evaluate a double integral numerically using 'quad2d' function over a triangular area.
c = 1;xib = 0;yib = 0.866;zi = 1e-05;gamma = 0.866;tmin1 = 0;tmax1 = @(s)sqrt(3)*(s+c/2);tmin2 = 0;tmax2 = @(s)sqrt(3)*(-s+c/2);rho = @(s,t)((xib-s).^2+(yib-t).^2+zi.^2).^(1./2);fintzz = @(s,t)-t./rho(s,t).^5;% touzz = (3*zi^3)/(2*pi*gamma).*quad2d(fintzz,0,gamma,smin,smax,'AbsTol',1e-15,'RelTol',1e-15,'FailurePlot',true,'MaxFunEvals',50000);
touzz1 = (3*zi^3)/(2*pi*gamma).*quad2d(fintzz,-c/2,0,tmin1,tmax1,'FailurePlot',true,'Singular',true,'MaxFunEvals',100000);touzz2 = (3*zi^3)/(2*pi*gamma).*quad2d(fintzz,0,c/2,tmin2,tmax2,'FailurePlot',true,'Singular',true,'MaxFunEvals',100000);touzz = touzz1+touzz2;
Initially, I was integrating over the entire triangular area in one line. I know that there is a singularity at point (0,0) for the integrand. After looking at some suggestions in MATLAB forums, I have split the integration region into two areas. I am using the above code to solve a bigger problem, for which I have analytical solutions. The results improved with splitting the region, but I am not getting an answer which is satisfactorily closer to the analytical values. The accuracy is not improving for whatever number of function evaluations I do, like here I have used 100000 evaluations, and I still get the warning. Can someone guide me with any better alternatives in MATLAB? Thanks.
Best Answer