how can I get rid of these errors?
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Roger Stafford
2013 年 5 月 28 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Semiconductors and Converters についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!