Question
I am fitting a Weibull distribution to a set of data "x" (10000 x 1). I want the distribution to have the same size. I am trying the following code XLim = get(gca,'XLim'); XLim = XLim + [-1 1] * 0.01 * diff(XLim); XGrid = linspace(XLim(1),XLim(2),10000); f_Weibull = fitdist(x, 'weibull'); f = pdf(f_Weibull,XGrid)'; However, somehow my PDF ends up being only NaN numbers, how can I solve this?
Expert Answer
Kshitij Singh
PhD Expert
Answered Aug 31, 2026
This code ran just fine for me, in 2015b:
rng 'default' x = wblrnd(1.5,1.3,10000,1); XLim = get(gca,'XLim'); XLim = XLim + [-1 1] * 0.01 * diff(XLim); XGrid = linspace(XLim(1),XLim(2),10000); f_Weibull = fitdist(x, 'weibull'); f = pdf(f_Weibull,XGrid)' figure histogram(f)
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related weibull Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →