Why does integral2 function changes the array size of variable over which integration is performed?
显示 更早的评论
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.
采纳的回答
更多回答(1 个)
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Numerical Integration and Differentiation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!