![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/172773/image.jpeg)
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.?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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?
0 commentaires
Réponses (2)
dpb
le 23 Fév 2017
Modifié(e) : dpb
le 23 Fév 2017
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/172773/image.jpeg)
for a particular set of random values; your results will vary but be similar.
Wasim Ramadan
le 12 Fév 2021
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
0 commentaires
Voir également
Catégories
En savoir plus sur Scatter Plots dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!