File Exchange

image thumbnail

Generation of Random Numbers with Laplace distribution with Matlab Implementation

version 1.1.0.0 (1.56 KB) by Hristo Zhivomirov
Generation of Laplacian distributed numbers with mean value mu = 0 and standard deviation sigma = 1.

14 Downloads

Updated 22 Apr 2018

View License

The present code is a Matlab function that provides a generation of random numbers with Laplace distribution, similarly to Matlab commands rand and randn. The output of the function is a matrix with Laplacian distributed numbers with mean value mu = 0 and standard deviation sigma = 1. If other values of mu and sigma are a must, then the following form could be used: mu + sigma*randl(m, n).
An example is given in order to clarify the usage of the function. For convenience the input and output arguments are given in the beginning of the function.

The code is based on the theory described in:

[1] S. Kotz, T. Kozubowski, K. Podgorski. The Laplace Distribution and Generalizations. New York, Springer Science & Business Media, 2001.

Comments and Ratings (5)

Thank you for your comment Mohammad! The appropriate correction will be made in the next update.

The variance of the samples is 2 not 1.

u1 and u2 are uniform between 0 and 1. then x=log(u1/u2) would be a Laplace distributed random variable with mean zero and variance of 2 (not 1)

Fengping Xu

thank you

YW D

haolun zeng

it's very useful

Updates

1.1.0.0

A new version of the code has been uploaded.

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux