Find which command used

1 view (last 30 days)
you wu
you wu on 3 Mar 2015
Commented: Adam on 6 Mar 2015
What matlab command, or combination of commands (using 25 characters or less), could be used to create the following matrix?
1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0
1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0
1 1 1 0 0 1 1 1 0 0 1 1 1 0 0 1 1 1 0 0
1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0
1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0
1 1 1 0 0 1 1 1 0 0 1 1 1 0 0 1 1 1 0 0
1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0
1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0
1 1 1 0 0 1 1 1 0 0 1 1 1 0 0 1 1 1 0 0
1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0
1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0
1 1 1 0 0 1 1 1 0 0 1 1 1 0 0 1 1 1 0 0
1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0
1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0
1 1 1 0 0 1 1 1 0 0 1 1 1 0 0 1 1 1 0 0
1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Hint: Look for a lower triangluar matrix that is repeated many times. First try to produce that lower triangular matrix with as few characters as possible.
  8 Comments
Jan
Jan on 6 Mar 2015
I miss Matt Figs the hump-day puzzlers. The assessment method of Cody collide with my personal opinion about nice and efficient code.
Adam
Adam on 6 Mar 2015
Yes, I never go near Cody personally since I found that 'best' solutions to many problems involve some ridiculous use of regexp. Personally my idea of good code doesn't involve using the fewest characters possible!

Sign in to comment.

Answers (1)

Star Strider
Star Strider on 3 Mar 2015
This looks like a homework assignment, so I’ll direct you to three functions: ones, tril, and repmat.
  2 Comments
you wu
you wu on 5 Mar 2015
sorry,not
Star Strider
Star Strider on 5 Mar 2015
I’m lost. What do you mean?

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!