normpdf — Evaluate the normal probability density function.

normpdf(x) evaluates the standard normal density. normpdf(x,mu) and normpdf(x,mu,sigma) evaluate a normal distribution with mean mu and standard deviation sigma.

Syntax

y = normpdf(x)
y = normpdf(x, mu)
y = normpdf(x, mu, sigma)

Inputs

NameTypeRequiredDefaultDescription
xAnyYesEvaluation point.
muAnyNo0Mean parameter.
sigmaAnyNo1Standard deviation parameter.

Returns

NameTypeDescription
yNumericArrayDistribution function value.

Errors

IdentifierWhenMessage
RunMat:normpdf:InvalidArgumentInputs are nonnumeric, sizes are incompatible, or too many arguments are supplied.normal distribution: invalid argument
RunMat:normpdf:InternalInternal tensor conversion or allocation fails.normal distribution: internal error

How normpdf works

  • x, mu, and sigma may be scalars or matching-size numeric arrays.
  • Nonpositive sigma values produce NaN elementwise.

Example

Standard normal density

y = normpdf(0)

Using normpdf with coding agents

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

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

FAQ

What is the default distribution?

The default is the standard normal distribution with mu = 0 and sigma = 1.

Open-source implementation

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

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.