正态概率分布函数与随机数的积分 [英] Integration of normal probability distribution function with random numbers

查看:112
本文介绍了正态概率分布函数与随机数的积分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

function Y=normpdf(X)
syms X
Y = normpdf(X);
int(Y,X,1,inf)
end

在N = 100的情况下,我需要整合从1到无穷大的普通pdf函数,其中N是生成的总数.我知道我需要使用randn()来生成随机数,但是我不知道如何使用它在这种情况下.

I need to integrate normal pdf function from 1 to infinity for the case of N=100 where N is the total numbers generated.I know i need to use randn() for generating random numbers but i dont know how to use it in this situation.

推荐答案

您可能有N = 100个来自t = randn(N, 1);的随机数.首先,我们使用t = sort(t)进行排序,然后使用p = (1 : N) / Nt来近似集成的PDF,即累积密度函数,就像使用plot(t, p)所看到的那样.它会与hold on, plot(t, normcdf(t), 'r')很好地重叠.

You could have N = 100 random numbers from t = randn(N, 1);. First, we sort with t = sort(t), then the integrated PDF, i.e. cumulative density function is approximated by your samples with p = (1 : N) / N for t as you can see with plot(t, p). It will overlap well with hold on, plot(t, normcdf(t), 'r').

这篇关于正态概率分布函数与随机数的积分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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