How do I plot two distributions on top of each other?

12 visualizaciones (últimos 30 días)
studentmatlaber
studentmatlaber el 2 de Oct. de 2021
Comentada: Star Strider el 4 de Oct. de 2021
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.

Respuestas (2)

Arthur Morais
Arthur Morais el 2 de Oct. de 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 comentario
studentmatlaber
studentmatlaber el 2 de Oct. de 2021
actually, secondly, my chart view does not match the normal distribution. I need to make the Y axes at the same time.

Iniciar sesión para comentar.


Star Strider
Star Strider el 2 de Oct. de 2021
To plot an additional distribution on the same axes, use the hold function. For the distribution itself, use the pdf function with a vector of ‘x’ values to create the data to plot. Several distributions could be characterised by those parameters, so choose the one you want.
.
  6 comentarios
studentmatlaber
studentmatlaber el 4 de Oct. de 2021
In fact, what I want to do here is to see how the fit I have drawn and the normal distribution with a mean of 0 and a variance of 1 will appear on top of each other. These two cannot be drawn together. I can't change the variance and the mean. Thank you for taking your time.
Star Strider
Star Strider el 4 de Oct. de 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.
.

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by