我正在尝试使用 Matlab 的 integral
比较复数积分的数值结果。
特别是,我想使用
检查结果的准确性- 一个固定的积分区间[0,T],
- 但不同的稀疏度或积分网格大小。
在使用 Matlab 的 integral
时,有没有办法指定积分网格大小(即:等距网格点的数量)?还是我应该寻找其他选择?
最佳答案
Is there a way to specify integration grid sizes (i.e.: number of equally spaced grid points) when using MATLAB's
integral
?
简短回答:否。
documentation说你只能输入:
q = integral(fun,xmin,xmax,Name,Value)
specifies additional options with one or more Name,Value pair arguments. For example, specify'WayPoints'
followed by a vector of real or complex numbers to indicate specific points for the integrator to use.
因此,我们向下滚动一点并读取允许的名称/值对并找到:
'AbsTol'
,绝对容错'RelTol'
, 相对误差容限'ArrayValued'
,数组值函数标志'Waypoints'
,整合航点
MATLAB 会自动优化积分并进行数值计算(当然),这会因给定错误而结束,错误由 'AbsTol'
和 'RelTol'
定义。我会同意的。
如果您确实想要指定积分步长,您可以检查如果将 'Waypoints'
指定为 [0:1/(100*T):T] 会发生什么情况
。不过,我会自己集成它,使用一个简单的黎曼求和实现。
关于matlab - 比较具有不同积分网格大小的数值结果 (MATLAB),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33646965/