How to display correlation coefficents on plot?

2 ビュー (過去 30 日間)
Dairien Perla
Dairien Perla 2021 年 5 月 4 日
回答済み: Rafael Hernandez-Walls 2021 年 5 月 5 日
x = [0 0.000009 0.000018 0.000028 0.000037 0.000046 0.000055 0.000065 0.000074 0.000083 0.000092 0.000102];
y = [0 0.200 .300 .600 .900 1.20 1.50 1.80 2.10 2.40 2.70 3];
err = [0 0.011 0.0176 0.035 0.053 0.077 0.08 0.105 0.123 0.14 0.159 0.1766];
errorbar(x,y,err)
Im trying to add the correlation coefficent to my plot. Is there a way to simply add this to display it on the graph?

回答 (1 件)

Rafael Hernandez-Walls
Rafael Hernandez-Walls 2021 年 5 月 5 日
you can try something like this:
x = [0 0.000009 0.000018 0.000028 0.000037 0.000046 0.000055 0.000065 0.000074 0.000083 0.000092 0.000102];
y = [0 0.200 .300 .600 .900 1.20 1.50 1.80 2.10 2.40 2.70 3];
err = [0 0.011 0.0176 0.035 0.053 0.077 0.08 0.105 0.123 0.14 0.159 0.1766];
errorbar(x,y,err)
CCR= corrcoef([x' y'])
text(0.00004,3,['Coef correlation= ' num2str(CCR(2,1))])

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by