MATLAB MATLAB Mfile MATLAB Help help mean Command
MATLAB 실행
MATLAB 에디터 : M-file
MATLAB Help >> help mean : Command Window에 해당 내용 이 출력된다. >> lookfor covariance : more general information >> helpwin: small window, hypertext >> helpdesk: HTML browser가 뜬다.
기본 산술 수식 1: 선형대수 규칙 � Summation and Subtract ◦ A + B & A – B : The same dimensions. ◦ 해당하는 각각의 행렬 값을 더하거나 뺀다 � Product ◦ A * B : A is m * n matrix & B is n * p matrix, ◦ the result is m * p matrix. � Division ◦ Left division : X = A B → inv(A)*B ◦ Right division : X = A / B → A*inv(B)
기본 산술 수식 1 예 >> a= [1 2; 3 4] a= 1 2 3 4 >> b= [0 1; 2 3] b= 0 1 2 3 >> c = a + b c= 1 3 5 7 >> a-b ans = 1 1 >> a * b ans = 4 7 8 15 X = A / B → A*inv(B) >> inv(a) ans = -2. 0000 1. 5000 -0. 5000 >> inv(b) ans = -1. 5000 1. 0000 >> x = a/b x= 0. 5000 -0. 5000 1. 5000 x = a/b = a * inv(b) 0. 5000 0 x(1, 1) = (a 11 * b 11) + (a 12 * a 21) =(1 * -1. 5) + (2 * 1) = 0. 5 x(1, 2) = (1 * 0. 5) + (2 * 0) = 0. 5 x(2, 1) = (3 *-1. 5) + ( 4 * 1) = -0. 5 x(2, 2) = (3 * 0. 5 ) + (4 * 0) = 1. 5
기본 산술 수식 2: 배열 연산 � � x. x. x. . * * y = [ xij * yij ] / y = [ xij / yij ] ^ y=[ ]. /. ^ 기호들은 각각의 배열값 에만 적용된다. a= 1 3 2 4 b= 0 2 1 3 >> a. *b ans = 0 2 6 12 >> a. ^b ans = 1 2 9 64 >> a. /b Warning: Divide by zero. ans = Inf 2. 0000 1. 5000 1. 3333 >> a. b ans = 0 0. 5000 0. 6667 0. 7500
난수생성 � � � rand : 0과 1 사이의 값으로 균등 분포를 갖는 단일 난수를 발생 rand(1, n) : 0과 1 사이의 값으로 균일 분포를 n개의 난수 행벡터 를 만든다. rand(n) : 0과 1사이의 값으로 균등 분포를 갖는 난수들로 이루어진 n. Xn 행렬을 만든다. >> rand ans = 0. 9501 >> a = rand(1, 4) a= 0. 6068 0. 4860 0. 8913 0. 7621 >> rand ans = 0. 2311 >> b = rand(2, 4) b= 0. 4565 0. 8214 0. 0185 0. 4447 0. 6154 0. 7919 0. 9218 0. 7382 >> c = rand(3) c= 0. 1763 0. 9169 0. 4057 0. 4103 0. 9355 0. 8936 >> d = rand(3, 1) d= 0. 1987 0. 6038 0. 2722 0. 0579 0. 3529 0. 8132
논리연산: 관계연산 < Less than <= Less than or equal to > Greater than >= Greater than or equal to == Equal to ~= Not equal to Relational Operations의 결과 true이면 1, false이면 >> y= [ 4 5 6] y= 4 5 6 >> k = y > 3. 0 k= 1 1 1 >> f = y > 5. 0 f= 0 0 1
논리연산 �z = n 2. *log(n 2+(n 2==0)); � a = n 2+(n 2==0); >> n 2 = [3 0] n 2 = 3 0 >> z = n 2. *log(n 2+(n 2==0)) z= 3. 2958 0 >> a = n 2+(n 2==0) a= 3 1
Plot 1 � � � Line Plots : plot. m, ploty. m, loglog. m etc Bar Plots : bar. m, barh. m etc Scatter Plots � Pie Charts Contour Plots 와 Mesh � plot 3와 surf �
Plot 4
- Slides: 38