Evaluate a distribution programmatically

ryan muddiman · Apr 14, 2022 · 1.9K views
Question
In the distribution fitter app there is an option to evaluate a fitted distribution for a range of values. I would like to know how to do this programmatically? I can use fitdist to fit the data easily but dont know how to evaluate the probability.
Expert Answer
Profile picture of Kshitij Singh
Kshitij Singh PhD Expert
Answered Aug 23, 2026

The fitdist  function will fit a distribution to data, producing a probability distribution object:

 

pd = fitdist(x,distname)

You can then calculate the probabilities with it using the Plot Standard Normal Distribution cdf or Pl

ot the pdf of a Standard Normal Distribution functions:

data = 5 + 2*randn(1, 100);                         % Create Data
pd = fitdist(data(:), 'Normal');

x = linspace(-2, 12);
Npdf = pdf(pd, x);
Ncdf = cdf(pd, x);

figure
plot(x, Npdf,   x, Ncdf)
grid

 

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

Get a Free Consultation or a Sample Assignment Review!