Why does integral2 function changes the array size of variable over which integration is performed?

2 ビュー (過去 30 日間)
I am using the following command to integrate the function 'fun' with respect to s and t.
X = integral2(fun,0,s_max, 0, t_max, 'method','iterated');
While integrating the size of s and t is taken as 45x1 but sometimes it becomes 30x1. Why the size of integrating variables changes? Whenever the size becomes 30x1 the result of integration is very large abnormal value of power 10^90.

採用された回答

Mike Hosea
Mike Hosea 2015 年 4 月 14 日
The iterated mode uses adaptive quadrature in each dimension, though your integrand function will, in a sense, be aware of only the inner integral. The length of the array is a function of the number of subintervals needing refinement, and in typical problems varies. With iterated integration it may not vary much if the initial mesh is already fine enough. Your observation that an incorrect result is associated with a certain size is not relevant, except insofar as it may indicate that a mesh refinement was needed. As Roger says, help us out with some more information about your problem, and perhaps we can tell you what the issue really is.

その他の回答 (1 件)

Roger Stafford
Roger Stafford 2015 年 4 月 13 日
Where you say "While integrating the size of s and t is taken as 45x1 but sometimes it becomes 30x1" , you are apparently referring to the array sizes of s and t which are being sent to your 'fun' integrand function. That is characteristic of many integration routines and the integrand functions must be written so as to properly handle any size array that is sent to them. You can read about this at:
http://www.mathworks.com/help/matlab/ref/integral2.html#inputarg_fun
This has nothing to do with the size of your integration result, which is determined by the integrand function along with the two sets of integration limits. If you obtained 10^90, look at your integrand to see why.
If you want more detailed information, you should show us how your 'fun' and the four integration limits are defined.

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by