Effacer les filtres
Effacer les filtres

How can I plot histogram?

3 vues (au cours des 30 derniers jours)
Amer Al-Maashani
Amer Al-Maashani le 29 Jan 2021
Commenté : Walter Roberson le 29 Jan 2021
I nedd help to scale the y-axis of Gaussian pdf
for example:
x = linspace(-20,20);
plot(x,normpdf(x,4,4))
How can I plot the histogram of this example?

Réponse acceptée

Walter Roberson
Walter Roberson le 29 Jan 2021
x = linspace(-20,20);
y = normpdf(x, 4, 4);
plot(x,y)
histogram(y, 10)
  3 commentaires
Walter Roberson
Walter Roberson le 29 Jan 2021
Sure.
x = linspace(-20,20);
y = normpdf(x, 4, 4);
plot(x,y)
hold on
histogram(y, 10)
hold off
Not very useful, though.
Walter Roberson
Walter Roberson le 29 Jan 2021
I suspect that you are looking for something like the following, but notice that it is exactly opposite to what you asked for.
r = normrnd(10,1,100,1);
histfit(r)

Connectez-vous pour commenter.

Plus de réponses (1)

Daniel Pollard
Daniel Pollard le 29 Jan 2021
Simply googling "matlab histogram" would have answered your question.
That link is for the documentation for histogram.
histogram(normpdf(x,4,4))
will do what you want.

Catégories

En savoir plus sur Data Distribution Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by