Rank: 4316 based on 4 downloads (last 30 days) and 5 files submitted
photo

Binbin Qi

E-mail
Company/University
China University of Petroleum

Personal Profile:

I love Matlab

Professional Interests:

 

Watch this Author's files

 

Files Posted by Binbin View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
18 May 2010 A more short code forgenerating a random matrix A of (1,-1); A more short code for generating a random matrix A of (1,-1),no loop Author: Binbin Qi bsxfun, randi 2 4
  • 1.0
1.0 | 1 rating
19 Jan 2010 Screenshot a red heart a red heart could get big by clicking the mouse on the figure Author: Binbin Qi demo 2 0
30 Sep 2009 Screenshot sway tree a fractal tree that can sway in the wind with IFS. Author: Binbin Qi ifs 0 0
  • 5.0
5.0 | 1 rating
29 Sep 2009 pass by a river solve a games use math tool Author: Binbin Qi dijstra 0 0
27 Sep 2009 Screenshot plot rose this is a simple program that plot a rose. Author: Binbin Qi 0 0
Comments and Ratings by Binbin View all
Updated File Comments Rating
26 Oct 2010 Classic Snake Game in MATLAB GUI Enjoy a simple and easy to play game where the snake needs to feed on its prey. Author: Akash Gupta

i don't know how to exit the game?can you tell me?

09 Sep 2010 isblank.m Determines if the argument string consists only of blanks. Author: janez

also, all(x==' ')
           all(isspace(x))

09 Sep 2010 isblank.m Determines if the argument string consists only of blanks. Author: janez

I think the main engine can be simplified:
                    x=length(deblank(x))==0

19 May 2010 A more short code forgenerating a random matrix A of (1,-1); A more short code for generating a random matrix A of (1,-1),no loop Author: Binbin Qi

thank you,I think the following is efficient
A=round(rand(m,n))*2-1;
A=floor(rand(m,n)*2)*2-1;
A=fix(rand(m,n)*2)*2-1;
A=randi([0,1],m,n)*2-1;

Comments and Ratings on Binbin's Files View all
Updated File Comment by Comments Rating
02 Aug 2011 sway tree a fractal tree that can sway in the wind with IFS. Author: Binbin Qi fiona, xiang
19 May 2010 A more short code forgenerating a random matrix A of (1,-1); A more short code for generating a random matrix A of (1,-1),no loop Author: Binbin Qi Fig, Matt

A general, ND version could look like:

function A = randmatrix(varargin)
A = floor(rand(varargin{:})*2)*2-1;

The 2D limitation, in addition to the need for usable help, a more descriptive name (something like RANDSIGNONES at least describes more closely what the code produces), and an H1 line prevent the file from being that useful as it now stands.

19 May 2010 A more short code forgenerating a random matrix A of (1,-1); A more short code for generating a random matrix A of (1,-1),no loop Author: Binbin Qi Qi, Binbin

thank you,I think the following is efficient
A=round(rand(m,n))*2-1;
A=floor(rand(m,n)*2)*2-1;
A=fix(rand(m,n)*2)*2-1;
A=randi([0,1],m,n)*2-1;

18 May 2010 A more short code forgenerating a random matrix A of (1,-1); A more short code for generating a random matrix A of (1,-1),no loop Author: Binbin Qi Tursa, James

Typo. The one-liner equivalent is: floor(rand(m,n)*2)*2-1

18 May 2010 A more short code forgenerating a random matrix A of (1,-1); A more short code for generating a random matrix A of (1,-1),no loop Author: Binbin Qi Tursa, James

This submission has the following problems:
1) It uses the relatively expensive power operator and bsxfun to generate the +1 and -1 values.
3) No H1 line.
4) No help.
5) A much faster (more than 3x faster) one-liner equivalent to this submission is as follows: floor(rand(n)*2)*2-1
6) There is no provision for multi-dimensional sizes. Only 2D sizes are supported.

James Tursa

Top Tags Applied by Binbin
bsxfun, demo, dijstra, ifs, mathematics
Files Tagged by Binbin View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
24 Jan 2011 egcd.m Extended greatest common divisor. Finds g = GCD(x(1), ..., x(end)) and v such that g == sum(v.*x). Author: Steven Gregory mathematics, vpi, number theory 2 0
18 May 2010 A more short code forgenerating a random matrix A of (1,-1); A more short code for generating a random matrix A of (1,-1),no loop Author: Binbin Qi bsxfun, randi 2 4
  • 1.0
1.0 | 1 rating
02 Mar 2010 linkplots links plots together Author: Matt Fetterman utility function 2 0
19 Jan 2010 Screenshot a red heart a red heart could get big by clicking the mouse on the figure Author: Binbin Qi demo 2 0
30 Sep 2009 Screenshot sway tree a fractal tree that can sway in the wind with IFS. Author: Binbin Qi ifs 0 0
  • 5.0
5.0 | 1 rating

Contact us at files@mathworks.com