I am getting an error 'Integrand output size does not match the input size' while using integral2
Show older comments
Hi,
I am numerically evaluating the double integral using integral2 matlab command. My code is as follows :
l1=0; m1=0; l2=0; m2=0;
funn = @(theta,phi)((Y_hsph_new(1,l1,m1,theta,phi))*(Y_sph_new(1,l2,m2,theta,phi)));
q = integral2(funn,0,pi/2,0,2*pi);
where 'Y_hsph_new' and 'Y_sph_new' are my own designed matlab function, whose output is a scalar value. While running this small code, I am geeting error :-
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 Coeff_conversion (line 21)
q = integral2(funn,0,pi/2,0,2*pi);
I tried to solve this but I am not understnding what's wrong in it. Can anyone help me in this regard. Thank You
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!