I want to have two Y axis with the same x axis , one of the Y axis is the histogram of the data and the other is prob plot of the same data.?

조회 수: 2 (최근 30일)
I want to have two Y axis with the same x axis , one of the Y axis is the histogram of the data and the other is prob plot of the same data.?any help, please?

답변 (2개)

dpb
dpb 2017년 2월 23일
편집: dpb 2017년 2월 23일
Ah, so...indeed that is pdf only...try something like--
y = evrnd(0,3,100,1); % some dummy data
[n,e]=histcounts(y); % counts with "best-guess" number bins
xhist=diff(e)/2+e(1:end-1); % the resulting bin midpoints
[c,x]=ecdf(y); % empirical cdf points values vs position
hAx=plotyy(xhist,n,x,c*100,@bar,@plot) % put above on one plot
ylabel(hAx(1),'PDF Hist') % prettify up some...
ylabel(hAx(2),'CDF Plot')
title('PDF and CDF for Sampled Exponential')
Above results in
for a particular set of random values; your results will vary but be similar.
  댓글 수: 1
ABDULLA RAHIL
ABDULLA RAHIL 2017년 2월 23일
thx for your help, but what I need is like that histogram with y_xais and cumulative probability with different y axis, one frequency and one (%)

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


Wasim Ramadan
Wasim Ramadan 2021년 2월 12일
Assuming you can create the plots you need already..
I suggest you take a look at this: https://www.mathworks.com/help/matlab/creating_plots/plotting-with-two-y-axes.html

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by