Rank: 7410 based on 8 downloads (last 30 days) and 1 file submitted
photo

Dave Correa

E-mail
Company/University
Fismatlab

Personal Profile:

Development projects and work on issues of science and engineering (mechanical, hydraulic systems, civil, industrial, environmental, chemical, electrical, electronics, physics, mathematics, statistics, ...) using programming software and graphical Matlab.

I teach courses, seminars, training workshops and classroom programming and graphic display on Matlab, mainly oriented to signal and image processing, numerical methods, statistics and general data processing, development and automation of processes and systems through the implementation of Matlab functions script, GUI and executable.

It provides advice and assistance in developing all kinds of university-level scientific technical and physical sciences, engineering, statistics and mathematics with Matlab.

The cost of the services are negotiable, 50% at start and 50% to finish the job.

To contract and information:

E-mail: correa.dave30 @ gmail.com

http://fismatlab.blogspot.com/


 

Watch this Author's files

 

Files Posted by Dave Correa
Updated   File Tags Downloads
(last 30 days)
Comments Rating
30 Jun 2011 Screenshot Choosse randomly number of elements from a vector Choosse randomly a number of elements from a vector. Randomly change the position of the vector Author: Dave Correa randomly, aleatorio, genera numeros aleato..., data random 8 7
Comments and Ratings by Dave Correa View all
Updated File Comments Rating
01 Jul 2011 Choosse randomly number of elements from a vector Choosse randomly a number of elements from a vector. Randomly change the position of the vector Author: Dave Correa

The objective of the randm2 function is to generate N unique random numbers in the range [ini fin].

Now, I think it would be much more efficient to use the function randperm as proposed Jan.

Thanks for your input
regards
Dave

30 Jun 2011 Choosse randomly number of elements from a vector Choosse randomly a number of elements from a vector. Randomly change the position of the vector Author: Dave Correa

Dear Matt;

Thank you very much for your suggestion.

If, it is an option, but I needed to create a function as part of a system.

Comments and Ratings on Dave Correa's Files View all
Updated File Comment by Comments Rating
14 Apr 2012 Choosse randomly number of elements from a vector Choosse randomly a number of elements from a vector. Randomly change the position of the vector Author: Dave Correa j_solar

Hey Jan, why do you say it is not useful due to the biased results?

I need a method like this but was wandering why it is not useful

ty

01 Jul 2011 Choosse randomly number of elements from a vector Choosse randomly a number of elements from a vector. Randomly change the position of the vector Author: Dave Correa Dave Correa

The objective of the randm2 function is to generate N unique random numbers in the range [ini fin].

Now, I think it would be much more efficient to use the function randperm as proposed Jan.

Thanks for your input
regards
Dave

01 Jul 2011 Choosse randomly number of elements from a vector Choosse randomly a number of elements from a vector. Randomly change the position of the vector Author: Dave Correa Matt Fig

Jan, you are absolutely correct. I made a mistake in understanding what this was supposed to do. Thanks for the catch.

Good thing I didn't provide a rating!

01 Jul 2011 Choosse randomly number of elements from a vector Choosse randomly a number of elements from a vector. Randomly change the position of the vector Author: Dave Correa Jan Simon

See also: http://www.mathworks.com/matlabcentral/fileexchange/27809

01 Jul 2011 Choosse randomly number of elements from a vector Choosse randomly a number of elements from a vector. Randomly change the position of the vector Author: Dave Correa Jan Simon

The results are not valid, e.g.: random2(0,1,2) always replies [0,1], the 3rd element of random2(0,2,3) is 2 always, random2(0,10,10) does never contain a 10. This is caused by "lon=fin-ini;", which must be updated to "fin-ini+1".
Running the loop 5 times is bewildering: According to D.E.Knuth it is enough to swap each element once with a random other one. Knuth's (aka Fisher-Yates) method can be found in the FEX already, see e.g.: http://www.mathworks.com/matlabcentral/fileexchange/30101-rpg-lab, http://www.mathworks.com/matlabcentral/fileexchange/27076-shuffle
I do not see a reason, why Matt's suggest cannot be written to a function. But the reply is not unique and it does not reply the 1st element (Matt: what's up?).
This would work: v=ini:fin; v=v(randperm(length(v))); out=v(1:num); It is faster than your method, but less efficient as the Fisher-Yates-Shuffle.
In the current state this function is not useful due to the biased results.

Contact us