Create a matrix x that contains the following row 1:the first 50 even numbers, starting from 0 row 2:the first 50 odd numbers, starting from 1 Use the colon operator to score the most efficient solution. No credit will be given for typing the numbers out

Respuesta :

D4B

Answer:

a=0:2:98;

b=1:2:100;

x=[a;b]

Step-by-step explanation:

a=0:2:98;% this will creat row1 which is a row matrix of 50 even numbers

b=1:2:100;% this will creat row2 which is a row matrix of 50 odd number

x=[a;b]% this will stack up the two row matrix a and b into one matrix x

THE RESULT

Columns 1 through 20

    0     2     4     6     8    10    12    14    16    18    20    22    24    26    28    30    32    34    36    38

    1     3     5     7     9    11    13    15    17    19    21    23    25    27    29    31    33    35    37    39

 Columns 21 through 40

   40    42    44    46    48    50    52    54    56    58    60    62    64    66    68    70    72    74    76    78

   41    43    45    47    49    51    53    55    57    59    61    63    65    67    69    71    73    75    77    79

 Columns 41 through 50

   80    82    84    86    88    90    92    94    96    98

   81    83    85    87    89    91    93    95    97    99