Reputation: 49
I've been given some data points and I've made a histogram out of them, and plotted a line through the mean.
I now need to "Include two dotted blue lines on each histogram showing the location of standard deviation on each side of the mean." But I'm not sure what this means. My only guess was to take the standard deviation of the values below the mean, and then take the standard deviation of the values above the mean, and then plot the two. Only it gives me two standard deviation to the left of the mean.
This is the code I did for that:
figure,
subplot(3,1,1)
histogram(AllValue,'BinWidth',.5), title('All Values')
mu=mean(AllValue, 'omitnan');
su=std(AllValue(AllValue<4.7450));
su2=std(AllValue(AllValue>4.7450));
hold on
plot([mu,mu],ylim,'r','LineWidth',2),
plot([su,su],ylim,'b--','LineWidth',2),text([su,su],ylim,'StdDev Left')
plot([su2,su2],ylim,'b--','LineWidth',2)
hold off
And this is the resulting graph:
Upvotes: 0
Views: 1026
Reputation: 3476
Most likely it means you should plot the one standard deviation limits to the plot, i.e. a horizontal dotted line at mu-sigma
and another one at mu+sigma
.
Here sigma
refers to the standard deviation of all the data, not ones below or above the mean, sigma=std(AllValue)
.
For example, you might do the following to draw the one standard deviation limit above the mean:
plot([mu+sigma,mu+sigma],ylim,'b--','LineWidth',2)
Upvotes: 3