title: How to obtain an equation for a line fitted to data
body: <p>I am trying to obtain an equation for a function fitted to some histogram data, I was thinking of trying to do this by fitting a rational function as the data doesn't resemble any distribution recognisable by myself.</p>
  
  <p>The data is experimental, and I want to be able to generate a random number according to its distribution. Hence I am hoping to be able to fit it to some sort of PDF from which I can obtain a CDF, which can be rearranged to a function into which a uniformly distributed random number between 0 and 1 can be substituted in order to obtain the desired result.</p>
  
  <p>I have attempted to use the <code>histfit</code> function, which has worked but I couldn't figure out how to obtain an equation for the curve it fitted. Is there something stupid I have missed?</p>
  
  <p><strong>Update</strong>: I have discovered the function <code>rationalfit</code>, however I am struggling to figure out what the inputs need to be.</p>
  
  <p><strong>Further Update</strong>: Upon exploring the <code>histfit</code> command further I have discovered the option to fit it to a <code>kernal</code>, the figure for which looks promising, however I am only able to obtain a set of <em>x</em> and <em>y</em> values for the curve, not its equation as a I wanted.</p>