如何用R中的密度函数绘制黎曼区间?

时间:2014-02-14 08:04:07

标签: r plot

我想将Riemann区间放在R中的下图中

x <- seq(0,1,0.01)

t <- dbeta(x,0.5,0.5)

plot(x,t, type='l')

我尝试使用hist()barplot(),但我还没有成功。

1 个答案:

答案 0 :(得分:2)

如果通过“黎曼间隔”表示在曲线下方拟合的矩形分区,其总面积是所述曲线积分的近似值,则可能是您正在寻找的:

x <- seq(0,1,0.01)
t <- dbeta(x,0.5,0.5)
plot(x,t, type='l')
for(i in seq_along(x)[-1])rect(x[i-1],(t[i]+t[i-1])/2,x[i],0)