create matrix like below --
for x=2,
y=[1 1 1 1 1; 1 2 2 2 1; 1 2 3 2 1; 1 2 2 2 1; 1 1 1 1 1] . for x=3, y=[1 1 1 1 1 1 1 1 1; 1 2 2 2 2 2 2 2 1; 1 2 3 3 3 3 3 2 1; 1 2 3 4 4 4 3 2 1; 1 2 3 4 5 4 3 2 1; 1 2 3 4 4 4 3 2 1; 1 2 3 3 3 3 3 2 1; 1 2 2 2 2 2 2 2 1; 1 1 1 1 1 1 1 1 1]
Solution Stats
Problem Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers20
Suggested Problems
-
Who knows the last digit of pi?
690 Solvers
-
Compute a dot product of two vectors x and y
1050 Solvers
-
Calculate the area of a triangle between three points
3420 Solvers
-
We love vectorized solutions. Problem 1 : remove the row average.
884 Solvers
-
1027 Solvers
More from this Author174
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!