Can I use contourf with two matrices?

조회 수: 53 (최근 30일)
Jaime  de la Mota
Jaime de la Mota 2018년 7월 10일
댓글: Jaime de la Mota 2018년 7월 11일
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:
However I find this not visually appealing. Is there any way of using contourf to show this?
Thanks for your answer.

채택된 답변

jonas
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)
  댓글 수: 1
Jaime  de la Mota
Jaime de la Mota 2018년 7월 11일
Yes. This helps me a lot. Thank you very much.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by