How do I plot two distributions on top of each other?
Mostra commenti meno recenti
I fit this histogram with the distribution fitter app. This fit is called the "t position scale" in practice. On top of this histogram, I want to plot a distribution with a mean of 0 and a variance of 1. I would be very grateful if you could help me figure out how to do this.

Risposte (2)
Arthur Morais
il 2 Ott 2021
You can write the plot command with the two variables that you have.
plot(data,density,data,distribution)
You can change the type of line adding markers.
plot(data,density,'b--',data,distribution,'k:')
If you don't use any markars, matlab chages only the color the of line.
1 Commento
studentmatlaber
il 2 Ott 2021
Star Strider
il 2 Ott 2021
0 voti
6 Commenti
studentmatlaber
il 2 Ott 2021
Star Strider
il 2 Ott 2021
Multiply ‘y’ by an appropriate constant, similar to what I did in your previous Question.
studentmatlaber
il 4 Ott 2021
For a variance (or standard deviation) of 1, ‘x’ needs to be longer and still symmetrical:
x = [-0.05:0.0001:0.05] * 100;
y = normpdf(x,0,1);
figure
plot(x,200*y)
Otherwise, only the very top of the distributtion is visible. To get it to fit the displayed distribution, reduce σ —
x = [-0.05:0.0001:0.05];
y = normpdf(x,0,0.0075);
figure
plot(x,200*y)
xlim([-1 1]*0.25)
text(-0.2,1E+4, '\it{N} (0, 0.0075)')
Experiment to get different results.
.
studentmatlaber
il 4 Ott 2021
Star Strider
il 4 Ott 2021
My pleasure!
To plot the requested
distribution,. it will be necessary to use the first curve. The data and fitted distribution will then essentially be a thin vertical red line, however there is no way to avoid that if the objective is to plot both in a single axes object.
.
Categorie
Scopri di più su Data Distribution Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


