How to display correlation coefficents on plot?
2 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(1 个)
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))])
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!