본문 바로가기

syms + ezplot = rocks! Problem. plot contours of the cost function J in the parameter space - 매트랩 코드 %% clear all clear all; close all; clc; % clear screen %% load data data = load('hw01_data1.dat'); input = data(:, 1:2); target = data(:, 3); % (a) get optimal value of the parameter vector parameter = pinv(input)*target; parameter %print parameter vector % (b) cov_input = cov(input); [V, D] = eig(cov_input); V %print .. 더보기
eig (Eigenvalue and Eigenvector) [V,D] = eig(A) V: Eigenvector D: Eigenvalue eig -Eigenvalues and eigenvectorsSyntaxd = eig(A) d = eig(A,B) [V,D] = eig(A) [V,D] = eig(A,'nobalance') [V,D] = eig(A,B) [V,D] = eig(A,B,flag) Descriptiond = eig(A) returns a vector of the eigenvalues of matrix A. d = eig(A,B) returns a vector containing the generalized eigenvalues, if A and B are square matrices. Note If S is sparse and symmetric, yo.. 더보기
mldivide \, mrdivide / (Matrix division) To solve the matrix equation Ax = b x = A\b; mldivide \, mrdivide / -Left or right matrix divisionSyntaxmldivide(A,B) A\B mrdivide(B,A) B/A Descriptionmldivide(A,B) and the equivalent A\B perform matrix left division (back slash). A and B must be matrices that have the same number of rows, unless A is a scalar, in which case A\B performs element-wise division — that is, A\B = A.\B. If A is a squ.. 더보기
Least Squres 매우 직관적인 방법이다. 주어진 데이터 x[n]을 우리가 임의로 선정한 s[n]에 맞추는 것이다. Θ를 파라미터라고 할 때 s[n] = HΘ이다. 이 때 H는 알고 있다고 한다. J(Θ) = SUM(x[n]-s[n])^2 을 최소화하는 Θ를 구한다. Θ_hat = inv(H'WH)H'x 이다. 이를 푸는 것을 normal equation을 푼다고 한다. 출처: http://poucotm.egloos.com/5872003 Part 1의 내용에 이어서 ... Vector 간 거리를 구하는 것이 √ ( x1 - x2 )^2 + ( y1 - y2 )^2 임을 상기하면 유사하다는 것을 알 수 있을 것이다. 이제 보다 확장할 것이다. Part 1의 마지막 그림에서 Vector a 의 line은 Column Spac.. 더보기