与Matlab无限集成 [英] infinite integration with matlab

查看:88
本文介绍了与Matlab无限集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Matlab中计算以下类型的积分.

I want to compute the following type of integrals in Matlab.

它是函数e ^-(u)* u的积分,边界为零和无穷大.该积分应返回1.

It is the integral of function e^-(u)*u and the boundaries are zero and infinity. This integral should return 1.

如何在Matlab中做到这一点?

How can I do this in Matlab?

推荐答案

如果您没有符号工具箱,或者想要提高速度,则quadgk支持无限限制:

And if you don't have the symbolic toolbox, or want more speed, quadgk supports infinite limits:

f = @(x) x.*exp(-x);
a = quadgk(f, 0, inf) 

a =
    1.000000000000000e+00

这篇关于与Matlab无限集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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