Problem 48995. Double the next number and alternate the sign
Given two numbers, m and n, find a matrix m x n where each element value is twice the value of the previous element and with opposite sign. Starting from the position (1,1) with value equal to 1, until the position (m,n), following the direction from left to right in each row.
For example, for m=2 and n=3, one should get:
y = [1 -2 4; -8 16 -32].
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers36
Suggested Problems
-
Longest run of consecutive numbers
6419 Solvers
-
Create a vector whose elements depend on the previous element
777 Solvers
-
829 Solvers
-
5040 Solvers
-
10202 Solvers
More from this Author11
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!