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?

 채택된 답변

Walter Roberson
Walter Roberson 2021년 1월 29일

0 개 추천

x = linspace(-20,20);
y = normpdf(x, 4, 4);
plot(x,y)
histogram(y, 10)

댓글 수: 3

Amer Al-Maashani
Amer Al-Maashani 2021년 1월 29일
Is it possible to add the histogram plot to the nomral normpdf? like both in the same plot.
Sure.
x = linspace(-20,20);
y = normpdf(x, 4, 4);
plot(x,y)
hold on
histogram(y, 10)
hold off
Not very useful, though.
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)

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

추가 답변 (1개)

Daniel Pollard
Daniel Pollard 2021년 1월 29일

0 개 추천

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.

카테고리

도움말 센터 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by