MATLAB Answers

Probablity distribution calculation for a vector

14 views (last 30 days)
Niki on 21 Aug 2014
Commented: Adam on 21 Aug 2014
I want to use the following function Y = normpdf(X,mu,sigma)
X is a vector of 100*1 for each X I have a mu and a sigma , do you know how to do that ?


Patrik Ek
Patrik Ek on 21 Aug 2014
You mean that every sample X have different sigma and mu or the same?
Adam on 21 Aug 2014
So what is the problem? You have a vector X, a vector mu and a vector sigma and a function that expects all these as inputs.

Sign in to comment.

Answers (1)

Roger Stafford
Roger Stafford on 21 Aug 2014
From the documentation for normpdf at
"Y = normpdf(X,mu,sigma) computes the pdf at each of the values in X using the normal distribution with mean mu and standard deviation sigma. X, mu, and sigma can be vectors, matrices, or multidimensional arrays that all have the same size. A scalar input is expanded to a constant array with the same dimensions as the other inputs. The parameters in sigma must be positive."
That should answer your question.

  1 Comment

Niki on 21 Aug 2014
Thanks but I knew this, my question is something different from what you just said

Sign in to comment.

Sign in to answer this question.

Translated by