matlab - Octave error when trying to integrate: "integrand F must return a single, real-valued vector of the same size as the input" -
i've confirmed issue in attempting compute glonball_2, don't see why it's producing error. function funct_2 should returning real numbers. "same size input" part, don't think i'm interpreting error message correctly. funct_2 takes 2 arguments , returns 1 value, funct_1, caused no error, that's not it. explain this? code:
function glonball = glonball(alpha) epsilon = 1; rmin = 0; rmax = 1; thmin = 0; thmax = 2*pi; funct_1 = @(r,th) (2).*(abs(alpha).^2-1).^(2)./abs(1-conj(alpha).*r.*exp(i.*th)).^4; glonball_1 = dblquad(funct_1, rmin, rmax, thmin, thmax); funct_2 = @(r,th) (abs(alpha.-r.*exp(i.*th))/abs(1-conj(alpha).*r.*exp(i.*th))).^2; glonball_2 = dblquad(funct_2, rmin, rmax, thmin, thmax); glonball = .5*glonball_1 + (1/((4).*epsilon^2))*glonball_2; end
here's error receive when attempting run input argument between 0 , 1 (the area of interest):
error: quadcc: integrand f must return single, real-valued vector of same size input error: called from: error: c:\software\octave-3.6.4\share\octave\3.6.4\m\general\dblquad.m @ line 72, column 10 error: @ line -1, column -1 error: quadcc: integrand f must return single, real-valued vector error: c:\software\octave-3.6.4\share\octave\3.6.4\m\general\dblquad.m @ line 65, column 5 error: c:\software\octave-3.6.4\glonball.m @ line 10, column 13
the .- unnecessary mention in comment above, doesn't cause errors in octave. give syntax error in matlab. similarly, / instead of ./ what's giving primary error.
after changing both of function ran fine in both octave 4.0.0 , matlab 2015a.
glonball(1) ans = 1.5708
Comments
Post a Comment