Matlab Indexing Given greyscale image G 20 19 18 17 16 15 1

Matlab Indexing

Given greyscale image G = [20 19 18 17; 16 15 14 13; 12 11 10 9; 8 7 6 5] Choose from answers A. G(1:2:end, 1:2:end) B. G(1:2:end, 2:2:end) C. G(2:2:end, 1:2:end) D. G(2:2:end, 2:2:end) to describe how each of the following matrices are computed: [16 14; 8 6] (A, B, C or D) [15 13; 7 5] (A, B, C or D) [19 17; 11 9] (A, B, C or D) [20 18; 12 10] (A, B, C or D)

Solution

Ans) [16 14;8 6]----------C is obtained by C . G(2:2:end,1:2:end) which gives--G(2,1) G(4,3),G(4,1),G(4,3)

which are explained below

because 16 is in row 2 column1,14 is in row 2 column3,8 is row 4 column1,6 is row 4 column3

similarly

[15 13;7 5]-------D G(2:2:end,2:2:end)

[19 17;11 9]-----B G(1:2:end,2:2:end)

[20 18 ;12 10]---- A G(1:2:end,1:2:end)

----------------------------------------------------

G(3)=G(3,1)=12 as matlab 1D indexing starts from column wise from top to bottom 1 to 4

--------------------------------

G(end)=G(4,4)=5 last element in the last column and last row

---------------------------------

1D index(row 2 column 3) for that element is 10 obtained counting column wise or (2*4)+(3-1)=8+2=10

---------------------------------------

G(1:5:end)=[G(1) G(6) G(11) G(16)]=[20 15 10 5]

Matlab Indexing Given greyscale image G = [20 19 18 17; 16 15 14 13; 12 11 10 9; 8 7 6 5] Choose from answers A. G(1:2:end, 1:2:end) B. G(1:2:end, 2:2:end) C. G

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site