| Author |
Comment/Response |
matt prior
|
09/24/07 10:33am
In Response To 'Re: Re: how to sample values from a listPlot' --------- Hi there
are you saying that you want to generate uniform random numbers with a range depending on the elements of a list, in the example you have given from 3 to 40? This would produce values which would lie between the points in your list.
The following code will achieve that result.
RandomPoint[listOfPoints_]:= (Random[] ( Max[listOfPoints] -Min[listOfPoints] ) ) + Min[listOfPoints]
So
Table[RandomPoint[mylist],{500}]
Will produce 500 points, uniformly distributed over the range between the maximum and minimum values in your list.
If you wanted to create points based on a probability distribution derived from the data in the list, rather than a uniform distribution, then you might want to investigate density estimation methods such as Parzen Windows or Mixtures of Gaussians.
Regards,
Matt
URL: , |
|