Filter löschen
Filter löschen

Weibull distribution plot x-axes scale is wrong

1 Ansicht (letzte 30 Tage)
Dora de Jong
Dora de Jong am 21 Okt. 2021
Beantwortet: Star Strider am 21 Okt. 2021
I am having problems with plotting a Weibull distribution for the variable: 'Cont_Wh_Wp'.
The x-axes shows weird scale, see figure below.
If I plot a histogram and and divide the x-axes by the number of point(662) the frequency on the x-axis seems to be better, see figure below.
The schape of both graphs are the same, but the x-axes is different. Below is my script where I plot the two grapgh.
%% Weibull
[parmHat, parmCI]=wblfit(Cont_Wh_Wp);
scale= parmHat(1);
shape=parmHat(2);
figure(1)
X=linspace(min(Cont_Wh_Wp),max(Cont_Wh_Wp));
plot(X,wblpdf(X,parmHat(1),parmHat(2)))
%% Histogram
figure(2)
histogram(Cont_Wh_Wp,80)
Can someone help me with getting the x-axis on the right scale for the Weibull plot?

Antworten (1)

Star Strider
Star Strider am 21 Okt. 2021
Try something like this —
%% Weibull
[parmHat, parmCI]=wblfit(Cont_Wh_Wp);
scale= parmHat(1);
shape=parmHat(2);
figure(1)
X=linspace(min(Cont_Wh_Wp),max(Cont_Wh_Wp));
plot(X,wblpdf(X,parmHat(1),parmHat(2)))
xl = xlim; % Get X-Axis Limits (Range)
%% Histogram
figure(2)
histogram(Cont_Wh_Wp,80)
xlim(xl) % Set X-Axis Limits (Range) To The First Plot Values
.

Tags

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by