MATLAB/OCTAVE-被积数的数值积分,该积分包含从ODE系统的数值解获得的项 [英] MATLAB/OCTAVE- Numerical integration of an integrand containing terms obtained from numerical solution of a system of ODE

查看:186
本文介绍了MATLAB/OCTAVE-被积数的数值积分,该积分包含从ODE系统的数值解获得的项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Octave(或Matlab)上计算以下积分:

I want to calculate the following integral on Octave(or Matlab):

但是,我没有H和K的明确表达式.H和K实际上是以下微分方程的数值解. h,k,dh/dr和dk/dr的初始条件分别为0,1、1/2/0.

However, I don't have an explicit expression for H and K. The H and K are actually numerical solutions of the following differential equations. The initial conditions of h,k, dh/dr, and dk/dr are 0,1,1/2,0 respectively.

我该怎么做?我可以直接以某种方式解决它,还是需要先找到H和K的数值解,找到一个多项式逼近,然后积分?我对Matlab和数值方法是完全陌生的,因此,最好的方法是描述所有内容.

How do I go about doing this? Can I solve it directly somehow, or do I need to find the numerical solutions to H and K first, find a polynomial approximation, and then integrate? I am completely new to Matlab and numerical methods, so a detailed method describing everything will be most appreciated.

推荐答案

如果您有能力在所需的任何时候求解HK,那么最好的选择就是在特定的时间评估它们点称为节点",然后使用数值积分方案来计算您的积分.基本思想是,根据积分方案,可以获得不同精度的结果.

If you have the ability to solve for H and K at any point desired, then the best option is going to be to evaluate them at specific points called 'nodes' and then use a numerical integration scheme to compute your integral. The basic idea is that, depending on the integration scheme, you can get results of different accuracy.

一个基本的有限总和就是简单地在等距的点上评估您的HK,然后将dx作为它们之间的空间.显然,这对于像您一样的无穷整数可能是有问题的,但是您也可以将内核重铸为有限域(取所有值的1/(x + 1),然后被积从(0,+ inf)变成( 1,0)-显然,您需要对所得积分取负数,然后将(1,0)变成(0,1)).

A basic finite sum would be simply evaluating your H and K at equidistant points and then taking dx to be the space in between them. This can obviously be problematic with an infinite integral like you have, but you can also recast the kernel into a finite domain (take the 1/(x+1) of everything and then your integrands turn from (0,+inf) to (1,0) - obviously you will need to take the negative of the resulting integral and turn (1,0) into (0,1)).

使用有限域,您可以使用所描述的有限和方法,或者在诸如Gauss-Legendre Quadrature之类的有限域上使用更精确的积分方案. http://en.wikipedia.org/wiki/Gaussian_quadrature

Using a finite domain you can use the finite sum method described, or a more accurate integration scheme over a finite domain like Gauss-Legendre Quadrature. http://en.wikipedia.org/wiki/Gaussian_quadrature

最后,如果您需要保留无限域,则可以使用更适合无限域的正交类型,例如Gauss-Laguerre正交,它将要求您将内核乘以Exp(x),以便结果权重(Exp(-x))不会更改您的内核. http://en.wikipedia.org/wiki/Gauss–Laguerre_quadrature

Finally, if you need to keep the infinite domain, it is possible use a quadrature type which is more suitable for infinite domains such as Gauss-Laguerre quadrature which will require you to premultiply your kernel by Exp(x) so that the resulting weights (Exp(-x)) do not change your kernel. http://en.wikipedia.org/wiki/Gauss–Laguerre_quadrature

这篇关于MATLAB/OCTAVE-被积数的数值积分,该积分包含从ODE系统的数值解获得的项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆