Weibull distribution plot x-axes scale is wrong
조회 수: 1 (최근 30일)
이전 댓글 표시
I am having problems with plotting a Weibull distribution for the variable: 'Cont_Wh_Wp'.
The x-axes shows weird scale, see figure below.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/774268/image.jpeg)
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/774273/image.jpeg)
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?
댓글 수: 0
답변 (1개)
Star Strider
2021년 10월 21일
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
.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!