我想在一个图中绘制直方图拟合和核密度曲线意味着我在一帧中计算 ks 密度曲线和 histfit 。
有人可以帮助我如何做到这一点。
我只是展示了我想要做的示例代码。
非常感谢 。
x = rand([1 50])
figure(1)
histfit(x)
hold on
[f,xi] = ksdensity(x);
hold off
figure
plot(xi,f);
绘图的函数调用不正确。本质上,hold on
要求 MATLAB 绘制此后的所有内容,与上一个图形重叠。hold off
禁用此功能并覆盖上一个数字。因此,像这样运行代码:
x = rand([1 50])
figure(1)
histfit(x)
hold on
[f,xi] = ksdensity(x);
plot(xi,f);
hold off
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句