Problem 43284. Form a square matrix from four square sub-matrices
Create a square matrix, y, from 4 square sub-matrices that will be constructed (x1, x2, x3, x4):
y = [x1 x2; x3 x4];
The size of each sub-matrix will be n, while given values should be applied to each sub-matrix.
- 1st sub-matrix: n1 on the main diagonal with all other elements equal to 0
- 2nd sub-matrix: all elements equal to n2
- 3rd sub-matrix: all elements equal to n3
- 4th sub-matrix: same as the first but with diagonal elements equal to n4.
For example, with n=2, n1=1, n2=2, n3=3, and n4=5:
y = [1 0 2 2; 0 1 2 2; 3 3 5 0; 3 3 0 5];
Solution Stats
Problem Comments
-
1 Comment
goc3
on 28 Nov 2016
The title and description of this problem have been cleaned up. Also, its test suite has been expanded and improved.
Solution Comments
Show commentsGroup

Operations
- 32 Problems
- 14 Finishers
- modular arithmetic
- Sum the 'edge' values of a matrix
- Subtract integers and add doubles
- Multiplication
- Let's get back to school, and create multiplication tables
- Make an N-dimensional Multiplication Table
- Mmm! Multi-dimensional Matrix Multiplication
- Accurate Division
- Number of even divisors of a given number
- Raise a polynomial to a power
- Array ex-OR
- Airline Ticket Mod7 Checksum
- Determinant without using det()
- Calculate the hypotenuse of a right triangle without using ^ and sqrt ()
- Calculate sin(x) without sin(x)
- Calculate cosine without cos(x)
- Negative without '-'
- calculate PI without using pi function
- Church Encoding
- Concatenated roots
- Product of Each Column
- Perl 1: push
- Vector push
- Vector pop
- Shuffle
- Please check the last row
- Converting Decimal to Binary
- Temperature Conversion Utility
- Temperature Conversion Utility (Strings)
- Calculate the sum of two polynomials
- Moving average (variable kernel length)
- Weighted average
Problem Recent Solvers106
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!