how can I get rid of these errors?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
hi I have a huge function to integrate
>> syms x y
>> f=(228155022448185.*(cos((2.*pi).*y)./exp(131738205584307./(35184372088832.*x)) - 1)*(cos((8.*pi).*y)/exp(131738205584307./(8796093022208.*x)) - 1)*(cos((8.*pi).*y)/exp(131738205584307./(8796093022208.*x)) + cos((18.*pi).*y)/exp(1185643850258763./(35184372088832.*x)) - 2))/((18014398509481984.*(x.^2)).*exp(x.*((1981232555272083.*(y.^2))/2251799813685248 - y./16 + 1./16)))
I need integration of it( x:[0,inf) and y:[0,1] )
but for this function I receive error for quad2d and dblquad
quad2d(quadfun,0,100,0,1)
??? Error using ==> quad2d>tensor at 350
Integrand output size does not match the input size.
Error in ==> quad2d at 164
[Qsub,esub] = tensor(thetaL,thetaR,phiB,phiT);
and
dblquad(quadfun,0,100,0,1)
??? Error using ==> dblquad>innerintegral at 74
Inputs must be floats, namely single or double.
Error in ==> quad at 76
y = f(x, varargin{:});
Error in ==> dblquad at 53
Q = quadf(@innerintegral, ymin, ymax, tol, trace, intfcn, ...
could you explain why these errors appear? and how can I fix it?
0 comentarios
Respuestas (1)
Roger Stafford
el 28 de Mayo de 2013
The 'quad2d' and 'dblquad' functions are intended for use with numerical data, namely 'double' or 'single' variables as the error message has stated. For integration with symbolic variables you should be using the 'int' function - in this case you need an 'int' of an 'int' to accomplish double integration. Either that or switch to 'double' type for x and y. (In the latter case you may encounter numerical difficulties with the x variable ranging from zero to infinity within the exponential function.)
0 comentarios
Ver también
Categorías
Más información sobre Semiconductors and Converters en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!