Find which command used

12 次查看(过去 30 天)
you wu
you wu 2015-3-3
评论: Adam 2015-3-6
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 个评论
Jan
Jan 2015-3-6
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 2015-3-6
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!

请先登录,再进行评论。

回答(1 个)

Star Strider
Star Strider 2015-3-3
This looks like a homework assignment, so I’ll direct you to three functions: ones, tril, and repmat.

Community Treasure Hunt

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

Start Hunting!

Translated by