Informatics1-2019/HW6

A MathWikiből
(Változatok közti eltérés)
(Új oldal, tartalma: „= MatLab = 6 points The task is to write two matlab functions, each in one <tt>.m</tt> file. You have to attack these files to your email. The name of the files should…”)
 
a (Magic Matrix (3 points))
8. sor: 8. sor:
 
Write a <tt>magicmatrix</tt> function that has two arguments: two positive integers ''n'' and ''m''.
 
Write a <tt>magicmatrix</tt> function that has two arguments: two positive integers ''n'' and ''m''.
 
The result should be a <math>n\times m</math> matrix with 0 and 1 values of a pattern where two ones are next to each other and the pattern goes diagonally up and right (two to the right, one upwards).
 
The result should be a <math>n\times m</math> matrix with 0 and 1 values of a pattern where two ones are next to each other and the pattern goes diagonally up and right (two to the right, one upwards).
This pattern should be begin at every third line.
+
This pattern should begin at every third line.
  
 
Example:
 
Example:

A lap 2019. december 2., 22:21-kori változata

Tartalomjegyzék

MatLab

6 points

The task is to write two matlab functions, each in one .m file. You have to attack these files to your email. The name of the files should be the same as the functions.

Magic Matrix (3 points)

Write a magicmatrix function that has two arguments: two positive integers n and m. The result should be a n\times m matrix with 0 and 1 values of a pattern where two ones are next to each other and the pattern goes diagonally up and right (two to the right, one upwards). This pattern should begin at every third line.

Example:

>> magicmatrix(12,10)
  1   1   0   0   0   0   1   1   0   0   0
  0   0   0   0   1   1   0   0   0   0   1
  0   0   1   1   0   0   0   0   1   1   0
  1   1   0   0   0   0   1   1   0   0   0
  0   0   0   0   1   1   0   0   0   0   1
  0   0   1   1   0   0   0   0   1   1   0
  1   1   0   0   0   0   1   1   0   0   0
  0   0   0   0   1   1   0   0   0   0   1
  0   0   1   1   0   0   0   0   1   1   0
  1   1   0   0   0   0   1   1   0   0   0
  0   0   0   0   1   1   0   0   0   0   1
  0   0   1   1   0   0   0   0   1   1   0

Elimination (3 points)

Deadline

2019 December 8th, 23:59

Személyes eszközök