Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'how to sample values from a listPlot' topicStudent Support Forum > General > Archives > "how to sample values from a listPlot"

< Previous CommentHelp | Reply To Comment | Reply To Topic
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: ,

Subject (listing for 'how to sample values from a listPlot')
Author Date Posted
how to sample values from a listPlot Rashide Ahmed 09/22/07 6:22pm
Re: how to sample values from a listPlot yehuda ben-s... 09/23/07 11:47am
Re: Re: how to sample values from a listPlot Rashide Ahmed 09/23/07 10:05pm
Re: Re: Re: how to sample values from a listPlot matt prior 09/24/07 10:33am
< Previous CommentHelp | Reply To Comment | Reply To Topic