本文介绍了如何在MATLAB中绘制置信区间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在MATLAB中绘制一些置信区间图,但是我完全不知道如何做.我将数据保存在.xls文件中.

I want to plot some confidence interval graphs in MATLAB but I don't have any idea at all how to do it. I have the data in a .xls file.

有人可以给我提示吗,或者有人知道用于绘制CI的命令吗?

Can someone give me a hint, or does anyone know commands for plotting CIs?

推荐答案

我不确定置信区间图的含义,但这是如何绘制正态分布的两侧95%CI的示例:

I'm not sure what you meant by confidence intervals graph, but this is an example of how to plot a two-sided 95% CI of a normal distribution:

alpha = 0.05;          % significance level
mu = 10;               % mean
sigma = 2;             % std
cutoff1 = norminv(alpha, mu, sigma);
cutoff2 = norminv(1-alpha, mu, sigma);
x = [linspace(mu-4*sigma,cutoff1), ...
    linspace(cutoff1,cutoff2), ...
    linspace(cutoff2,mu+4*sigma)];
y = normpdf(x, mu, sigma);
plot(x,y)

xlo = [x(x<=cutoff1) cutoff1];
ylo = [y(x<=cutoff1) 0];
patch(xlo, ylo, 'b')

xhi = [cutoff2 x(x>=cutoff2)];
yhi = [0 y(x>=cutoff2)];
patch(xhi, yhi, 'b')

这篇关于如何在MATLAB中绘制置信区间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 04:57