2

There are many questions like this on stackoverflow but they are either talking about Python or R. How can I do this thing in MATLAB?

There is a function normpdf(x,mu,sigma) in MATLAB which generates distribution with desired mu and sigma.

Equivalently, Is there any way by which I can add skewness and kurtosis to distribution generated by normpdf function?

Cris Luengo
  • 55,762
  • 10
  • 62
  • 120
Luqman Saleem
  • 191
  • 10
  • See here: https://www.mathworks.com/matlabcentral/answers/51897-generate-random-numbers-given-distribution-histogram – Cris Luengo Jul 20 '18 at 19:50
  • 1
    `normpdf` generates a Gaussian (normal) distribution. With that distribution shape you only get to specify two parameters: mean and variance. Skewness and kurtosis are then determined by those, and cannot be changed. You would need another distribution shape that lets you specify those four parameters (I don't know of any) – Luis Mendo Jul 20 '18 at 23:28
  • Another thing to note is that Gaussian distributions are by definition 0 skew and kurtosis – Durkee Jul 21 '18 at 19:57
  • @Durkee, a minor correction. The Gaussian (normal) distribution has a kurtosis of 3. Excess kurtosis is zero. See [here](https://itl.nist.gov/div898/handbook/eda/section3/eda35b.htm) and [here](https://stats.stackexchange.com/questions/126346/why-kurtosis-of-a-normal-distribution-is-3-instead-of-0) for details. – SecretAgentMan Oct 16 '18 at 18:40

1 Answers1

0

I don't have my stats textbooks at hand, but take a look at Characteristic Function. You can relate it to a random variable's pdf through the distributions moments. You'll need to construct the Characteristic Function (or it's log, I can't recall), and the fourier transform it. I don't know any matlab function that lets you build an arbitrary pdf. Hope it helps a bit.

Puff
  • 503
  • 1
  • 4
  • 14