Assume a general nelement sequent for write an expression in
Solution
%first one starts here
 x = [10 2 14 7 9 12 31 6 4 7];
 [r c]=size(x);
 index =1;
 for i=1:3:c%takes the step 3, so that other two will be get skipped
 newx(index)=x(i);
 index = index+1;
 end
 disp(newx)
output:
10 7 31 7
%second one starts here
 x = [10 2 14 7 9 12 31 6 4 7];
 [r c]=size(x);
 index =1;
 for i=-1:c
 if i<1%condition to insert two zeros in the beginning of the matrix
 newx(index)=0;
 else
 newx(index)=x(i);
 end
 index = index+1;
 end
 disp(newx);
output:
Columns 1 through 7
0 0 10 2 14 7 9
Columns 8 through 12
12 31 6 4 7

