Graphs of mean and standard deviation

123 ビュー (過去 30 日間)
Khayroon Suleyman
Khayroon Suleyman 2019 年 12 月 8 日
編集済み: dpb 2019 年 12 月 8 日
How do I create a graph to show mean and standard deviation. I have 6 sets of means and 6 sets of SD that I want to show on a graph.

回答 (2 件)

dpb
dpb 2019 年 12 月 8 日
編集済み: dpb 2019 年 12 月 8 日
A typical plot would be use errorbar, alternatively there's boxplot that shows data in somewhat different fashion than explicitly those two specific values. One can always use bar as well...so many choices; all depends on what it is one is trying to show.
  2 件のコメント
Khayroon Suleyman
Khayroon Suleyman 2019 年 12 月 8 日
I have 6 variables - happysame, happydifferent, sadsame, saddifferent, angrysame, angrydifferent. Each of these 6 variables have a mean and SD each. So, would I have 6 different error bars showing the mean and SD for each?
dpb
dpb 2019 年 12 月 8 日
編集済み: dpb 2019 年 12 月 8 日
Read the documentation and look at the examples...we don't know what you have in mind, specifically.
On a stylistic note, having metadata in the variable names ("happy,sad,angry" and/or "same,different") is NOT a good way to name variables in Matlab (or most any other programming language, either, but particularly so with the array syntax of Matlab). It means you have to write explicit code for every possible combination whether the actual operations are the same/different or not and generally most if not all will be.
Use a generic name for the data ("response" might be a good one here) and then encode the conditions as either secondary (probably categorical here) variables or use array indexing to keep track for given response type.
Then, when you're ready to plot the data, you can simply plot the array or combinations of the responses by the alternate variables as undoubtedly you'll be wanting to do next.

サインインしてコメントする。


Star Strider
Star Strider 2019 年 12 月 8 日
There are several ways, depending on what you want to do. See the errorbar function for one option.

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by