À§ÀÇ Matrix Ç¥ÇöÀ» Matlab¸í·ÉÀ¸·Î Ç¥ÇöÇϸé,

                   A = [ 1.2  10  15 ; 3  5.5  2 ; 4  6.8  7 ];

                 À§ÀÇ ¸í·É¿¡¼­ ÁÖÀÇÇÏ¿©¾ß ÇÒ °ÍÀº ÄÞ¸¶°¡ ÀÖ´Â °Í°ú ¾ø´Â °ÍÀÇ

                 Â÷ÀÌÁ¡Àε¥ ÀÖ´Â °ÍÀº ¸í·ÉÀÇ °è»ê°úÁ¤À» Ãâ·ÂÇÏÁö ¾Ê°í,

                 ¾ø´Â °ÍÀº °è»ê°úÁ¤À» Ãâ·ÂÇÑ´Ù

          - Transpose¸í·É

                  A = [ 1  2  3 ; 4  5  6 ; 7  8  9 ];

              Transpose¸í·É :  B=A' 

           - Complex Number : Çã¼öºÎ´Â j·Î Ç¥ÇöÇÔ

                 x = 1 + 3i

                    -> Matlab¸í·É    

                           x = 1 + 3*j

            - Norms 

                 ¸ÇÀ§ÀÇ Matrix¸¦ ¿¹·Î µé¾î ÇÁ·Î±×·¥Çϸé,

                  x = [ 1.2  10  15 ; 3  5.5  2 ; 4   6.8  7 ];

                  norm(x)

                  Ãâ·Â

                   ans =21.3346

             - Eigen value and eigen vectors

                A = n¡¿n matrix

                Ax = ¥ëx  -> ¥ë: eigenvalue

                ¸í·É : eig(A)

             - Characteristic equation

                ¸í·É : p = poly( A)

             - Product of Polynomials

                 a=[1 0 -20.6]; b=[1 19.6 151.2];

                 c=conv(a,b)

                 Ãâ·Â

                 c =

                      1.0e+003*

                         0.0010   0.0196   0.1306   -0.4038   -3.1147

               - Array Searching

                   i=find(x)   :  element°¡ nonzeroÀÎ ¹è¿­ xÀÇ »öÀÎÀ» ãÀ½

                   [r,c]=find(x)  : element°¡ nonzeroÀÎ ¹è¿­xÀÇ Çà°ú ¿­À» ãÀ½   

                   ¿¹) ´ÙÀ½ º¤ÅÍÀÇ ¿ä¼ÒÁß 5º¸´Ù Å« Çà°ú ¿­À» ±¸ÇÔ

                

                      A=[1 2 3;4 5 6;7 8 9]

                      A=

                            1    2   3

                            4    5   6

                            7    8   9

                       [i,j]=find(A>5)

                         Ãâ·Â  ->  Áï (3,1),(3,2),(2,3),(3,3)

                          i =  

                                   3

                                   3

                                   2

                                   3

                           j =

                                   1

                                   2

                                   3

                                   3

              - Array Size

                  whos : ÇÁ·Î±×·¥¿¡ »ç¿ëµÈ ¸ðµç º¯¼ö¿Í Å©±â ±âŸ ºÎ°¡Á¤º¸¸¦

                             È­¸é»ó¿¡ Ãâ·Â

                  s=size(A)  : º¤ÅÍÀÇ Çà°ú ¿­ÀÇ °¹¼ö¸¦ Ãâ·Â

                 [r,c]=size(A) : r¿¡´Â ÇàÀÇ ¼ö¸¦ Ãâ·ÂÇÏ°í c¿¡´Â ¿­ÀÇ °¹¼ö¸¦ Ãâ·Â 

                 r=size(A,1) : º¯¼ö r¿¡ ÇàÀÇ °¹¼ö¸¦ Ãâ·Â

                 c=size(A,2) : º¯¼ö c¿¡ ¿­ÀÇ °¹¼ö¸¦ Ãâ·Â

                 n=length(A) : Çà°ú ¿­ÀÇ °¹¼öÁß Å«¼ö¸¦ º¯¼ön¿¡ Ãâ·Â   

                  ¿¹)

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

                       A=

                             1   2   3   4

                             5   6   7   8

                        s=size(A)

                        s=

                               2     4  

                         n=length(A)

                         n=

                                4

               - Array Manipulation Fuctions

                 flipud(A)  : MatrixÀÇ ÇàÀ» À§¾Æ·¡·Î ¹Ù²Þ

                 fliplr(A) : MatrixÀÇ ¿­À» ¿ÞÂÊ°ú ¿À¸¥ÂÊÀ» ¹Ù²Þ

                 rot90(A) : Matrix¸¦ ¹Ý½Ã°è¹æÇâÀ¸·Î 90µµ ȸÀü

                 diag(A) : column º¤ÅÍ·Î matrixÀÇ diagonalÀ» ÃßÃâÇÔ

                 tril(A) : matrix AÀÇ lower triangular part¸¦ ÃßÃâÇÔ

                 triu(A) : matrix AÀÇ upper triangular part¸¦ ÃßÃâÇÔ         

               -Plotting ¿¹Á¦

                    t=0:0.05:10;

                    y=sin(t);

                    plot(t,y)

                    grid

                    title('Sine Curves');

                    xlabel('Sec')

                    ylabel('Y=sin t')  

           

 

     

         - Logical operator

               &   : AND¿¬»ê

                |   : OR¿¬»ê

               ~   : NOT¿¬»ê

        - Logical Fuctions

               xor(x,y) : x,yÀÇ Exclusive OR¿¬»êÀ» ÇÔ

               any(x) : º¤ÅÍ xÀÇ ¿ä¼Ò°¡ 0ÀÌ ¾Æ´Ñ ¾î¶² ¿ä¼Ò¸¦ °¡Áö¸é 1À» ¸®ÅÏÇÔ

               all(x) : º¤ÅÍ xÀÇ ¿ä¼Ò¸ðµÎ°¡ 0ÀÌ ¾Æ´Ò ¶§¸¸ 1À» ¸®ÅÏÇÔ

                

        1. FOR Loops

            -±¸¹®

                for x=array

                   {commands}

                end

             ¡Ø x=1:10 -> ÃʱâÄ¡°¡ 1ÀÌ°í 10±îÁö 1¾¿ Áõ°¡ÇÔ

                 x=1:.5:10  -> ÃʱâÄ¡°¡ 1ÀÌ°í 10±îÁö 0.5¾¿ Áõ°¡ÇÔ

             ¿¹Á¦ )

              for n=1:10

                 x(n)=sin(n*pi/10);

              end 

              

               ->Ãâ·Â

             >>x     <- ¸í·É ÇÁ·ÎÇÁÆ®¿¡ x¶ó°í ÀÔ·ÂÇÏ¸é ¾Æ·¡¿Í °°ÀÌ

                             Ãâ·ÂµÊ

             x=

             Columns  1  through 7

             0.3090   0.5878   0.8090   0.9511   1.0000   0.9511   0.8090

 

    2. WHILE Loops

       - ±¸¹®

             while  expression

                 {commands}

             end

       ¿¹Á¦)

         >>num=0;eps=1;

         >>while (1+eps)>1

                eps=eps/2;

                num=num+1;

             end

        ->Ãâ·Â

          >> num

                num=

                         53

          >> eps=2*eps

                eps=

                         2.2204e-16                          

    3. IF-ELSE-END Structures

       -±¸¹®

           if  expression

               ÂüÀÏ ¶§¸¸ ½ÇÇàµÇ´Â ¸í·Éµé

           else

               °ÅÁþÀÏ ¶§¸¸ ½ÇÇàµÇ´Â ¸í·Éµé 

           end

 

  

      1. ±¸¹®

          fuction ÇÔ¼ö¼±¾ð

             ¸í·É¾îµé

       ¿¹Á¦)

                function  y=linspace(d1,d2,n)

                if  nargin==2

                    n=100;

                end

                y=[d1+():n-2)*(d2-d1)/(n-1)   d2];

 

      1. Roots : PolynomialÀÇ root¸¦ ã´Â °ÍÀº PolynomialÀÌ 0ÀÏ ¶§

          - Matlab¿¡¼­ÀÇ PolynomialÀº ³»¸²Â÷¼øÀ¸·Î °è¼öÀÇ row vector·Î

             Ç¥ÇöÇÔ

          ¿¹Á¦)

            

           >> p=[1 -12 0 25 16]             ¡çmatlab¿¡¼­ÀÇ polynomialÇ¥Çö  

           >> r=roots(p)                         ¡çmatlab¿¡¼­ root¸¦ ±¸ÇÏ´Â ÇÔ¼ö

                 r=11.8111

                      1.8218

                      0.8165 + 0.2744i

                      0.8165 - 0.2744i               

    2. Polynomial Multiplication

        ¿¹Á¦)

            >>a=[ 1 2 3 4 ]; b=[ 1 4 9 16 ];

            >>c=conv(a,b)          ¡çmatlab¿¡¼­ polynomial multiplication

            c=

                1   6   20   50   75   84   64   

     3. Polynomial Division

           >> [q,r]=deconv(c,b)  ¡çmatlab¿¡¼­ polynomial division

           q=

               1   2   3   4

           r=

               0   0   0   0   0   0   0    

     4. Polynomial Derivatives

           >>g

                g=

                     1   6   20   48   69   72   44

           >>h=polyder(g)  ¡çmatlab¿¡¼­ polynomial ¹ÌºÐ

                h=

                    6   30   80   144   138   72

       5. Polynomial Evaluation

        ¿¹Á¦)

           >>x=linspace(-1,3);

           >>p=[ 1 4 -7 -10];

           >>v=polyval(p,x);   ¡çp(x)¸¦ °è»ê

           >>plot(x,v)

           >>grid

          

       6. Rational Polynomials

        ¿¹Á¦)

           

           >>num=10*[1  2];

           >>den=poly([-1;-3;-4]);

           >>[res,poles.k]=residue(num,den)

                res=

                       -6.6667

                         5.0000

                         1.6667

                poles=

                         -4.0000

                         -3.0000

                         -1.0000

                k=

                          []

 

         

            1. plot3 Function

              -±¸¹®

                plot3(x1,y1,z1,s1,x2,y2,z2,s2,...)

             ¿¹Á¦)

                  >>t=0:pi/50:10*pi;

                  >>plot3(sin(t),cos(t),t)

                  >>grid

             

           2. MESH Plots 

              ¿¹Á¦)

                 >>[x,y,z]=peaks(30);

                 >>mesh(x,y,z)

                ¡Ø peaksÇÔ¼ö : °¡¿ì½Ã¾È ºÐÆ÷¸¦ °ýÈ£¾ÈÀÇ ¼ö¸¸Å­ °®°ÔÇÔ

                  

                   >>[x,y,z]=sphere(30);

                   >>mesh(x,y,z)

                        ¡Ø sphereÇÔ¼ö : ±¸ÀÇ Á¶°¢À» °ýÈ£¾ÈÀÇ ¼ö·Î ³ª´®

                   

       3. Surface Plot

           ¿¹Á¦)

             >>[x,y,z]=peaks(30);

             >>surf(x,y,z)

            

                         

 

        1. Transfer Fuction to state space : Transfer functionÀ» State space form

            À¸·Î º¯È¯ÇÔ

             [ A, B, C, D ] = tf2ss(num,den)

             Transfer function form      

              

              State-space Form

             

         2. State space to Transfer function : State space formÀ» Transfer

              function formÀ¸·Î º¯È¯

              [num, den]= ss2tf(A, B, C, D)

         3. ¿¹Á¦

           State space formÀ» Transfer fuction formÀ¸·Î º¯È¯

       

          

            ( ÇÁ·Î±×·¥ )

                A = [ 0 1 ; -2 -3 ];

                B = [ 1 0 ; 0 1 ];

                C = [ 1 0 ];

                D = [ 0 0 ];

                [num, den] = ss2tf(A, b, C, D, 1)

                 Ãâ·Â

                  num =

                            0     1    3

                  den = 

                            1     3     2

             

        4. Partial fraction expansion of the Transfer fuction

             

               num = [b(1) b(2) ... b(n)];

                den = [a(1) a(2)  ... a(n)];

               [r,p,k] = residue(num,den)  -> Partial fraction¸í·É¾î

         5. Step Response

              ¿¹Á¦1)

               

                -> Matlab ÇÁ·Î±×·¥

                   num = [ 0 0 25 ];

                    den = [ 1 4 25 ];

                   step(num,den)

                   grid

                    

 

              ¿¹Á¦2) ÀÌ ¿¹Á¦´Â Ãʱâ»óŸ¸À» °í·ÁÇÑ´Ù

                                      

                          m = 1kg, b = 3N-s/m,  k = 2N /m

                        

                        1)  system equation

                            ->

                        2) Unit step Response

                              

                        3) ÇÁ·Î±×·¥

                                 num = [0.1 0.35 0];

                                 den = [ 1 3 2];

                                 step(num,den)

                                 grid