title: Sampling from multivariate customised cumulative distribution function in Matlab
body: <p>Consider a 5-variate <a href="https://en.wikipedia.org/wiki/Cumulative_distribution_function" rel="nofollow noreferrer">cumulative distribution function</a> (cdf) which I call F.  </p>
  
  <p>I want to sample random 5x1 vectors from this cdf in Matlab. F is not a cdf that has been already implemented in Matlab (such as normal, t-student, etc.). Specifically, it is defined as</p>
  
  <p><a href="https://i.stack.imgur.com/SL4qM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SL4qM.png" alt="enter image description here"></a></p>
  
  <p>I have read several question/answers in this and other forums on how to sample from customised probability distribution functions in Matlab. However,</p>
  
  <p>1) Most of them are for univariate cdf, e.g. <a href="https://stackoverflow.com/questions/47894953/matlab-generate-random-numbers-from-custom-made-probability-density-function">here</a>. The idea is to apply <a href="https://en.wikipedia.org/wiki/Inverse_transform_sampling" rel="nofollow noreferrer">inverse transform sampling</a>. My problem is a bit more complicated because I would need to "invert"a 5-variate function. </p>
  
  <p>2) Another option could be to use <a href="https://uk.mathworks.com/help/stats/slicesample.html" rel="nofollow noreferrer">slicesample</a> as suggested <a href="https://uk.mathworks.com/matlabcentral/answers/35861-how-to-sample-from-custom-2d-distribution" rel="nofollow noreferrer">here</a> but I don't know how to write the analytical expression of the probability density function in my case. </p>
  
  <p>3) <a href="https://stackoverflow.com/questions/10208667/simulate-samples-from-a-joint-cumulative-distribution-function">Here</a>'s another idea but specific for the bivariate case. </p>
  
  <p>Could you kindly help me to understand how I can proceed?</p>