How to display correlation coefficents on plot?

조회 수: 3 (최근 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 CenterFile Exchange에서 2-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