Prev: How do I remove the loop in this?
Next: PV model
From: rynn on 3 Mar 2010 06:02 Hi, Can anyone help me on how to generate random number with this condition:- 1) I have 100 data and want to select 10 sample. However, I have to repeat choosing the 10 sample for 30 times. 2) the model that I want to develop here is nonlinear model with 1 output and 4 input variables (x1,x2,x3,x4). So I got confusing about which variables or only output data that I have to use in order to generate a random sample. Thanks in advance.. rynn.
From: Walter Roberson on 3 Mar 2010 14:20 rynn wrote: > Hi, > > Can anyone help me on how to generate random number with this condition:- > 1) I have 100 data and want to select 10 sample. However, I have to > repeat choosing the 10 sample for 30 times. With or without replacement for each trial? If it is without replacement, then: [a,b] = sort(rand(100,30)); selectedsamples = samples(b(1:10,:)); Each column will be the samples for one trial. (I put them into columns because you probably want to access a trial at a time and access along columns is faster in Matlab.) > 2) the model that I want to develop here is nonlinear model with 1 > output and 4 input variables (x1,x2,x3,x4). So I got confusing about > which variables or only output data that I have to use in order to > generate a random sample. It is not clear how the second part of your question relates to the first part? Is the probability of selection of particular samples non-uniform? If so then with or without replacement??
|
Pages: 1 Prev: How do I remove the loop in this? Next: PV model |