I'd suggest adding test cases in which n (or abs(n)) is larger than the dimension of x; for example, x is a 4-by-4 matrix and n = 6.
251 Solvers
Test if a Number is a Palindrome without using any String Operations
181 Solvers
Back to basics 9 - Indexed References
396 Solvers
Flag largest magnitude swings as they occur
588 Solvers
Find out total non zero element of matrix
196 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!