Can I use contourf with two matrices?
62 次查看(过去 30 天)
显示 更早的评论
Hello everyone, I have two matrices if size 9*50.000 called fX and fY, I want to see how they correlate. I have done the following to graphically represent the correlation:
for i=1:repetitions
fXi=fX(:,i);
fYi=fY(:,i);
plot(fXi, fYi, '.')
end
And I have obtained the following image:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/191781/image.jpeg)
However I find this not visually appealing. Is there any way of using contourf to show this?
Thanks for your answer.
0 个评论
采纳的回答
jonas
2018-7-10
编辑:jonas
2018-7-10
Perhaps you are looking for a density plot, try this:
hist3([fX(:), fY(:)],'CDataMode','auto')
You can increase the number of bins to make it more visually appealing, by adding [NBinsX NBinsY] as the second argument.
You can also plot the output using contourf
nbins=[30 30];
[N,C]=hist3([fX(:), fY(:)],nbins)
contourf(C{1},C{2},N)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!