Search This Blog

Monday, 22 May 2017

MATLAB COMMANDS

imread Command and imshow Command:-

i = imread('C:\Users\user\Downloads\hello.jpg')

imshow(i)
Output:

figure,imshow Command:-

i = imread('C:\Users\user\Downloads\hello.jpg')
imshow(i)
k = imread('coins.png')
figure,imshow(k)

Output :-


subplot Command :-

i = imread('C:\Users\user\Pictures\5.jpg')
subPlot(2,2,3),imshow(i);

k = imread('C:\Users\user\Pictures\6.jpg')
subPlot(2,2,1),imshow(k)

j = imread('C:\Users\user\Pictures\7.jpg');
subPlot(2,2,2),imshow(j);

l = imread('C:\Users\user\Pictures\8.jpg');
subPlot(2,2,4),imshow(l);

Output:-


Vectors and Matrix:

·         Matrix
A= [5 6 7; 1 2 3; 7 4 1]

Output:
                         A =     5     6     7
                                    1     2     3
                                    7     4     1
·         Row vectors
r = [4 5 2 1]
Output:
r =   4     5     2     1

·         Column vector:
j = [1; 8; 7; 4]
Output:
j =        1
                                    8
                                    7
                                    4

·         Transpose vector:
j = [1; 8; 7; 4]
T = j'
Output:
j =   1
                                8
                                7
        4

T =   1     8     7     4

·         Printing 0 to 20 numbers with interval of 3
 k = [0:3:20]
0utput:
k = 0     3     6     9    12    15    18

·         Printing row of matrix
       A=[5 6 7 ; 1 2 3 ; 7 4 1]
       A(1,:)
Output
A =

     5     6     7
     1     2     3
     7     4     1

ans =

     5     6     7
·         Addition and substraction of matrix
A=[5 6 7 ; 1 2 3 ; 7 4 1]
B = [A A;A+6 A-2]
Output:
A =

     5     6     7
     1     2     3
     7     4     1


B =

     5       6      7        5     6     7
     1      2      3        1     2     3
     7      4      1        7     4     1
    11    12    13     3     4     5
     7       8      9     -1     0     1
    13    10     7      5     2    -1







1 comment: