RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

RunMat™ is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

LicensePrivacy
/
See all docs
Builtin Reference
    • binocdf
    • boxplot
    • cdf
    • cdfplot
    • chi2cdf
    • corr
    • corrcoef
    • corrcov
    • cov
    • cov2corr
    • dummyvar
    • ecdf
    • filloutliers
    • fitdist
    • geomean
    • grpstats
    • harmmean
    • icdf
    • isoutlier
    • kstest
    • kurtosis
    • lsline
    • mad
    • mode
    • nanmax
    • normalize
    • normcdf
    • norminv
    • normpdf
    • onehotdecode
    • onehotencode
    • pdf
    • prctile
    • quantile
    • refline
    • rmse
    • skewness
    • tabulate
    • tcdf
    • tiedrank
    • tinv
    • tpdf
    • ttest2
    • wblinv

fitdist — Fit a probability distribution object to sample data.

fitdist(x,distname) estimates distribution parameters from vector data and returns a ProbabilityDistribution object accepted by pdf, cdf, icdf, and random.

Syntax

pd = fitdist(x, distname)
pd = fitdist(x, distname, Name, Value)

Inputs

NameTypeRequiredDefaultDescription
xNumericArrayYes—Sample data or evaluation points.
distnameStringScalarYes—Distribution name.
NameValueAnyVariadic—Name-value options.

Returns

NameTypeDescription
pdAnyFitted probability distribution object.

Errors

IdentifierWhenMessage
RunMat:fitdist:InvalidArgumentSample data, distribution name, options, or evaluation inputs are malformed.fitdist: invalid argument
RunMat:fitdist:NumericalDistribution parameter estimation fails to converge or is ill-conditioned.fitdist: numerical failure
RunMat:fitdist:InternalRunMat cannot construct distribution outputs.fitdist: internal error

How fitdist works

  • Supported fitted distributions are "Normal", "Exponential", "Lognormal", "Gamma", "Weibull", and "Poisson"; common short aliases such as "norm", "exp", "logn", "gam", "wbl", and "poiss" are accepted.
  • Input data must be a numeric vector. The compatibility target documents double observations; typed-integer observations are a mode-gated RunMat extension and must be exactly representable as binary64. NaN observations are ignored and Inf observations are rejected.
  • fitdist(x,distname,"Frequency",w) requires one nonnegative finite integer-valued count per observation. The compatibility target documents single or double count storage; typed-integer Frequency storage is an independently gated RunMat extension. Zero-frequency observations are ignored.
  • Range constraints follow the selected distribution: exponential data must be nonnegative, lognormal/gamma/weibull data must be positive, and Poisson data must be nonnegative integers.
  • The returned object exposes DistributionName, DistName, ParameterNames, ParameterValues, NumParameters, NumObservations, NLogL, IsTruncated, and scalar parameter properties such as mu, sigma, lambda, a, or b.

Examples

Fit a normal distribution and evaluate it

pd = fitdist([1;2;3], "Normal"); y = pdf(pd, 2); p = cdf(pd, 2); x = icdf(pd, 0.5)

Fit with observation frequencies

pd = fitdist([1;2], "Exponential", "Frequency", [1;3])

Using fitdist with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how fitdist changes the result.

Run a small fitdist example, explain the result, then change one input and compare the output.

FAQ

Can fitdist fit typed-integer observations or Frequency arrays?⌄

In MATLAB-compatible mode, no. RunMat mode adds separately declared integer-data and integer-Frequency extensions for all eight built-in integer classes, with exact binary64-boundary validation. Results remain host probability-distribution objects with floating parameters.

Does fitdist support censoring or custom optimization options?⌄

Not yet. Censoring, Options, and grouped By fits are rejected explicitly rather than ignored.

Related Stats functions

Summary

binocdf · boxplot · cdf · cdfplot · chi2cdf · corr · corrcoef · corrcov · cov · cov2corr · dummyvar · ecdf · filloutliers · geomean · grpstats · harmmean · icdf · isoutlier · kstest · kurtosis · lsline · mad · mode · nanmax · normalize · normcdf · norminv · normpdf · onehotdecode · onehotencode · pdf · prctile · quantile · refline · rmse · skewness · tabulate · tcdf · tiedrank · tinv · tpdf · ttest2 · wblinv

Ml

bayesopt · classify · confusionmat · crossvalind · cvpartition · fitclinear · fitctree · fitlm · kmeans · knnsearch · lasso · lassoglm · linkage · lscov · mnrfit · optimizableVariable · pdist · pdist2 · perfcurve · predict · regress · ridge · squareform · test · training · tsne

Random

binornd · bootstrp · datasample · dividerand · exprnd · gamrnd · lhsdesign · mvnrnd · normrnd · random · randsample · rng · trnd · unidrnd · unifrnd · wblrnd

Hist

histc · histcounts · histcounts2

Options

statget · statset

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how fitdist is executed, line by line, in Rust.

  • View the source for fitdist in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • How fitdist works
  • Examples
  • Fit a normal distribution and evaluate it
  • Fit with observation frequencies
  • Using fitdist with coding agents
  • FAQ
  • Related Stats functions
  • Summary
  • Ml
  • Random
  • Hist
  • Options
  • Open-source implementation
  • About RunMat