Question followed by octave 3.0.0 commands
1. Matrix of 256 x 1 ones-----ones(1,256)
2. Matrix of integers 0 - 255 in a single row........[0:1:255]
3. Single column of integers 0 -255.........[0:1:255]'
4. A 256x256 matrix with rows , all same, equal to numbers 0 - 255.......ones(256)*[0:1:255]
5. A 256 x256 matrix with columns all the same equal to 1-255.............[0:1:255]'*ones(1,6)
6. A 256 x 256 matrix all zeros........zeros(256)
7. A 256x256 matrix all ones.......ones(256)
8. A 256x256 matrix of the value 128......128*ones(1,256)
9. Repeat of 6
Display of gray scale image
imshow(gray(100)')
Display of RB face
x(:,:,1) = (ones(256)*(255:-1:0)/255)';
x(:,:,2)=zeros(256);
x(:,:,3) = ones(256,1)*(0:1:255)/255;
imshow(x)
12.RG face of color cube
x(:,:,1) = (ones(256,1)*(0:1:255)/255)';
x(:,:,2)= ( ones(256,1)*(255:-1:0)/255);
x(:,:,3)=zeros(256);
imshow(x)
13. GB face of color cube
x(:,:,1) = zeros(256);
x(:,:,2) = (ones(256,1)*(0:1:255)/255);
x(:,:,3) = (ones(256,1)*(255:-1:0)/255)'
imshow(x)
14. CM face of color cube
x(:,:,1) = (ones(256,1)*(255:-1:0)/255)';
x(:,:,2) = (ones(256);
x(:,:,3) = (ones(256,1)*(0:1:255)/255)';
imshow(CM)
15. Y-M face of color cube
x(:,:,1) = ones(256);
x(:,:,2) = ones(256,1)*(0:1:255)/255;
x(:,:,3) = (ones(256,1)*(255:-1:0)/255)';
imshow(MY)
16. YC face of color cube
x(:,:,1) =ones(256);
x(:,:,2) =(ones(256,1)*(0:1:255)/(255);
x(:,:,3)=(ones(256,1)*(255:-1:0)/255)';
imshow(x)
1. Matrix of 256 x 1 ones-----ones(1,256)
2. Matrix of integers 0 - 255 in a single row........[0:1:255]
3. Single column of integers 0 -255.........[0:1:255]'
4. A 256x256 matrix with rows , all same, equal to numbers 0 - 255.......ones(256)*[0:1:255]
5. A 256 x256 matrix with columns all the same equal to 1-255.............[0:1:255]'*ones(1,6)
6. A 256 x 256 matrix all zeros........zeros(256)
7. A 256x256 matrix all ones.......ones(256)
8. A 256x256 matrix of the value 128......128*ones(1,256)
9. Repeat of 6
Display of gray scale image
imshow(gray(100)')
Display of RB face
x(:,:,1) = (ones(256)*(255:-1:0)/255)';
x(:,:,2)=zeros(256);
x(:,:,3) = ones(256,1)*(0:1:255)/255;
imshow(x)
12.RG face of color cube
x(:,:,1) = (ones(256,1)*(0:1:255)/255)';
x(:,:,2)= ( ones(256,1)*(255:-1:0)/255);
x(:,:,3)=zeros(256);
imshow(x)
13. GB face of color cube
x(:,:,1) = zeros(256);
x(:,:,2) = (ones(256,1)*(0:1:255)/255);
x(:,:,3) = (ones(256,1)*(255:-1:0)/255)'
imshow(x)
14. CM face of color cube
x(:,:,1) = (ones(256,1)*(255:-1:0)/255)';
x(:,:,2) = (ones(256);
x(:,:,3) = (ones(256,1)*(0:1:255)/255)';
imshow(CM)
15. Y-M face of color cube
x(:,:,1) = ones(256);
x(:,:,2) = ones(256,1)*(0:1:255)/255;
x(:,:,3) = (ones(256,1)*(255:-1:0)/255)';
imshow(MY)
16. YC face of color cube
x(:,:,1) =ones(256);
x(:,:,2) =(ones(256,1)*(0:1:255)/(255);
x(:,:,3)=(ones(256,1)*(255:-1:0)/255)';
imshow(x)
For questions 19 - 22
Let Matrix A=
19 Shift entries of a matrix A one place left(wrapping around left-> right)
Octave> [ 1 2 3; 4 5 6; 7 8 9]*[0 0 1;1 0 0;0 1 ];
20 Shift the entries of a matrix A one pixel down (wrapping around the bottom->up)
Octave> [0 0 1;1 0 0;0 1 0]*A;
21.Shift the entries of a matrix A one place left(dropping values on the left edge)
Octave> [0 0 0;1 0 0;0 1 0]*A;
22. Shift the entries of a matix A one place down (dropping values on the bottom edge)
Octave: [0 0 0;1 0 0;0 1 0]*A;
No comments:
Post a Comment