Why I am getting "Vector X must be strictly increasing or strictly decreasing with no repeated values" error while plotting contour of joint probability distribution?!

10 ビュー (過去 30 日間)
yas
yas 2019 年 12 月 12 日
編集済み: yas 2019 年 12 月 12 日
HI. I am trying to plot a joint distribution for xi and yi which are numbers and independent. (something like the image). Size of both xi and yi is 6980*1 that is why I put 6980 for bins in hist3(). I get this error and I don’t know how to fix it. Do you have any recommendation?
Error using contour (line 53)
Vector X must be strictly increasing or strictly decreasing with no repeated values.
Error in new (line 24)
contour(xi,yi,pdfData,'ShowText','on','LineWidth', 1.5);
%% Data :
xi = xlsread('All.xlsx',1,'B:B');
yi = xlsread('All.xlsx',1,'C:C');
%% hist3 will bin the data
hst = hist3([xi,yi],'Nbins',[6980 6980]);
%% histogram data
dx = xi(2)-xi(1);
dy = yi(2)-yi(1);
area = dx*dy;
pdfData = hst/sum(sum(hst))/area;
%% plot pdf
figure(1); clf
contour(xi,yi,pdfData,'ShowText','on','LineWidth', 1.5);
c = colorbar;

回答 (0 件)

カテゴリ

Help Center および File ExchangeContour Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by