Print value of correlation to a plot displaying two functions
1 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I have a plot displaying observed (y1) and simulated (y2) data vs year (x). I want to plot each one as a time series to visually compare them, but I would also like to print the value of the rank correlation between them :
corr(y1,y2,'Type','Kendall')
Basically I want to print the result of this on the plot, without having to copy-paste the value
figure(); hold on;
plot(Year,y1);
hold on;
plot(Year,y1);
txt = {'Corr = *value of correlation*'};
text(4,0.5,txt)
Any ideas ?
Thanks !
0 个评论
采纳的回答
更多回答(1 个)
Sam Chak
2022-4-18
Perhaps like this?
v = corr(y1,y2,'Type','Kendall');
txt = ['Corr = ', num2str(v)];
text(4, 0.5, txt)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!