MATLAB: Double Intergral Over an Ellipse with Varying Radius

integralintegrationnumerical integration

Hi, please I'd appreciate any support in solving this problem. I am trying to evaluate the double integral given in the following equation.
where,
In the integral, can be assumed constants as their values are known apriori.
Here is my issue, when I try to evaluate this integral, I get error messages about incorrect dimensions for matrix multiplication. I am not sure where this issue is arising from, and I have tried to debug myself all to no avail. It'd great if anyone can help. Here is my code
% Variables
R = 0;
h = 20;
b = 1.2;
k = 1.6*10^5;
ec = 0.009;
x = 0;
% Functions
v = @(t) b./sqrt(1 -(ec*cos(t)));
fun = @(t,r) r.*log(1 + (k./(r.^2+h^2+R^2+(2.*r.*sqrt(h^2+R^2)*sin(-t+x)))));
% Integral evaluation
I = integral2(fun,0,2*pi,0,v);
The error messages I get when I run the above code is as follows:
Error using *
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the
second matrix. To perform elementwise multiplication, use '.*'.
Error in @(e,r)r.*log(1+(k./(r.^2+h^2+Ri^2+(2.*r.*sqrt(h^2+Ri^2)*sin(-e+x)))))
Error in integral2Calc>integral2t/tensor (line 237)
Z1 = FUN(X(VTSTIDX),Y(VTSTIDX)); NFE = NFE + 1;
Error in integral2Calc>integral2t (line 55)
[Qsub,esub] = tensor(thetaL,thetaR,phiB,phiT);
Error in integral2Calc (line 9)
[q,errbnd] = integral2t(fun,xmin,xmax,ymin,ymax,optionstruct);
Error in integral2 (line 106)
Q = integral2Calc(fun,xmin,xmax,yminfun,ymaxfun,opstruct);

Best Answer

  • .* sin(...)
    ^ missed