2012-07-22 145 views
1

我有一个函数y = f(x),我想在Matlab中绘制直方图,其中我有[n,n + 1]中x的总和。 在Matlab中是否有一个函数自动执行?累积直方图

回答

0

cumtrapz
http://www.mathworks.com/help/techdoc/ref/cumtrapz.html

例子:

x = linspace(0, pi, 30); 
y = cos(x); 
yint = cumtrapz(x, y); 
plot(x, yint, 'x'); 
hold on; 
% exact integral 
plot(x, sin(x), '-'); 
+0

等待,说我有0到20之间的真正的X,我如何才能Y的20个积分的向量相对于X? – 2012-07-22 16:29:20