MATLAB: Double Integral using Integral2 Error

functionintegration

I am trying to write code for the attached equation in matlab but I am getting errors.
My code is as under;
phi=0.0:0.01:90;
P=sqrt((pi^2*Ef*df^3*rounot*S*(1+n))/(4)+(pi^2*Ef*df^3*Gd)/(2));
p_phi=sin(phi);
p_z=2/Lf;
m1=P*exp(f*phi); %multiplier,inside the integral part of eq#8.
m2=(4*Vf)/(pi*df^2); %multiplier, outside the integral part of eq#8.
myfun_eq8=@(z,phi) m1.*p_phi.*p_z;
I= integral2(myfun_eq8,0,1,0,pi/2);
sigma_b=m2*I;
I am getting the following error, can someone help me correct it.
Error using integral2Calc>integral2t/tensor (line 241) Integrand output size does not match the input size.
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);
Error in myeqsetlin (line 160) I= integral2(myfun_eq8,0,1,0,pi/2);

Best Answer

Based on the above discussion, the critical part of code you need is as follows:
myfun_eq8=@(phi) exp(f*phi).*cos(phi).*sin(phi);
I= integral(myfun_eq8,0,pi/2);
All the other terms can stay outside of the integral.