ECE 65 /8 Homwork St - Solutions. (Stark & Woods #.) X: zro-man, C X Find G such that Y = GX will b lt. whit. (Will us: G = -/ E T ) Finding -valus for CX: dt = (-) (-) = Finding corrsponding -vctors for CX: For (CX - = - + sqrt() = sqrt() = For (CX - = + sqrt() = sqrt() + = / G = -/ E T = 6 5 5 5 = sqrt() (Normalizd to unit-lngth) = (-/) sqrt() (Normalizd to unit-lngth)
ECE 65 /8. (Stark & Woods, #.6) Two jointly normal RV s X and X hav joint pdf givn by: 8 f(x,x ) = xp7 x xx x 7 7 Find A such that Y = AX yilds componnt RV s Y and Y that ar indpndnt (Rcall for Gaussians, uncorrlatd implis indpndnt; so w can us a whitning filtr, A = G = -/ E T ) / x x xx x [x x ] / x C X - = / / From MATLAB, C X - has ignvalus ( = /, = 7/), and ignvctors: =, ; Thus, C X has th sam ignvctors, but with ignvalus and /7. Rcall in-class discussion about factoring quadratics. From Linar Alg: If matrix C has - vctor and -valu, thn matrix C - has th sam -vctor, with -valu /. A = -/ E T = / / 7 / / / / 7 7 Using vctor matrix form, with C Y = A C X A T = 7 7 7 7 7 = 7 7 7 7 7 = 7 (Vrifying that th Y componnts ar uncorrlatd and thus indpndnt, sinc Gaussian) f(y, y ) = y y xp = I
ECE 65 /8 5 5. Z: zro-man, with C Z R Z a. Finding th RMS lngth Z: MS-lngth: E{ Z } tr(rz) 7 RMS-lngth: sqrt(7).85 b. Dirctional prfrnc of Z: (-vctor of CZ with largst -valu,.56 obtaind from MATLAB using: [V lambda] = ig(cz)) c. MATLAB Cod to obtain Scholtz Panut (uss functions rms_lngth and unit_lngth_bs, both givn in Lctur 7 or 7.): thta = : : 5; thta = thta'; % col. vctor of angls, in dgrs cov = [5 ; ]; % ntring th covarianc matrix RMS = rms_lngth(thta, cov); % cod givn in Lctur 7 or 7. hold on [V lambda] = ig(cov) % to find max, min, lambda_max, lambda_min x = [ sqrt(6.85)*.85]; y = [ sqrt(6.85)*.56]; % for plot of max xmin = [ sqrt(.6)*.56]; ymin= [ sqrt(.6)*(-.85)]; % for plot of min plot(x, y), plot(xmin, ymin) % plotting min, max on Scholtz panut Rsult: (Also O.K. to do a hand-plot for max, min ) Scattr plot Quadratur - sqrt(lambda_max) max sqrt(lambda_min) min - - - In-Phas
ECE 65 /8. Giv a scond-momnt dscription of output vctor R if X is an lmntary, ral, whit vctor, and if A and b ar A =, b R = AX + b, R = b = RR = A RX A T = 5 5 I Scond-ordr dscription of ral random vctor R: {RR, R}, 5 5 5a. MATLAB Cod to find causal H for covarianc matrix C: >> C = [5 ; ]; >> R = chol(c); >> H = R' H =.6.89.95 5b. MATLAB Cod to gnrat, -dimnsional whit standard normal vctors, W, and mak a scattrplot: >> W = normrnd(,,,); >> W = normrnd(,,,); >> W = [W W]; >> scattrplot(x) 5c. MATLAB Cod to color th whit vctors from 5b, obtaining vctors X, and mak a scattrplot. (Includ dirctional prfrnc.) A b R X
ECE 65 5/8 >> X_almost = H*W' % havn t addd constant c c = [; ]; for icount = : % for loop to add in constant c X_almost(:,icount) = X_almost(:, icount)+c; nd scattrplot(x_almost') Whit: Colord: Scattr plot 8 Scattr plot Quadratur - Quadratur 6 - (,) Dirctional prfrnc: [.89.7], starting at [ ] - - -6 - - - - In-Phas -8-5 5 In-Phas 6. Writ out th xpandd form for th givn quadratic form: x T A x = x x x 5 5 x x 7 x Starting on th righ sid of x T Ax, multiplying out Ax w obtain th x matrix: x x 5x x x x 5x x 7x Pr-multiplying th abov answr by xt yilds th scalar: x x x 5x x x x x x x 5x x x x 7 x = x + x + 7x + x x x x + 6 x x. (combining lik trms) Not that this agrs with th xpctation w hav basd on quadratic factoring.
ECE 65 6/8 7. Writ in th form x T A x: a. x + x x + x 7a. ½ A =, ½ X A X = [x x ] b. -9x x 6x + 6x x -8x x + x x x x 7b. ½ A = 9 / /, ½ X A X = [x x x ] 6 9 / x / x 6 x 8. (Tutorial Problm: Gram-Schmidt, QR, and matrix invrss) a. Writ a MATLA B function calld Gram_Schmidt to comput th Gram- Schmidt Orthogonalization on th columns (say x k ) of an input matrix X. (You may assum that th input matrix is squar.) Us th algorithm givn in Lctur 5. Hav your cod put th nw orthogonal columns {u i / u i } in a matrix calld Q, so that th first lin of your cod should b: Q = function Gram_Schmidt(X) Us MATLAB s function rats( ) to mak th lmnts of Q b in rational form. MATLAB Cod: function [ Q ] = Gram_Schmidt( X ) % function Gram_Schmidt taks as input a matrix X; % th output matrix Q contains unit-lngth orthonormal % column vctors spanning th sam spac as th columns % of input matrix X. (Algorithm from p. 9 of Lct. 5) % Notation; column vctor in lctur nots is a % column of Q hr. % Column vctor x in lctur nots is a column of X % hr; Q =zros(siz(x)); [m n] = siz(x); Q(:,) = X(:,)/norm(X(:,)); % sts = x/ x for j = :n % running through columns of X and Q sum_proj = ; % initializing sum trm to for k = :j- sum_proj = sum_proj+ dot(q(:,k),x(:,j))*q(:,k);
ECE 65 7/8 nd Q(:,j)=X(:,j)- sum_proj; Q(:,j) = Q(:,j)/norm(Q(:, j)); nd Q = rats(q); nd b. Tst your function by passing in th input matrix X = [ -5 6 67-68 - -] MATLAB call statmnt and rsult; not X (givn abov) had bn dfind in th command window: >> Q = Gram_Schmidt(X) Q = 6/7-69/75-58/75 /7 58/75 6/75 -/7 6/5 -/5 c. Us MATLAB s function qr( ) to find th QR-Factorization of X as givn in part b. (Not that th Q matrix should again b th sam Q (up to sign) as computd by your Gram-Schmidt program. Th R matrix should b uppr triangular, containing projction valus. For xampl, row will contain:, dot(, x ), and dot(, x ). MATLAB s qr factorization: >> [Q R] = qr(x) Q = -.857.9. -.86 -.99 -..857 -.7.99 R = -. -.. -75. 7. -5. In MATLAB, typ: >> doc qr
ECE 65 8/8 Not Q from QR factorization agrs with our Q obtaind by Gram-Schmidt Orthogonalization. Also not: in row of R matrix: dot(x, ) =, th lngth of th projction of x onto. d. Us MATLAB to comput Q T Q. Writ a fw sntncs to xplain th answr. >> Q'*Q ans =. -. -. -... -... Q Q is th idntity matrix, bcaus th columns of Q ar orthogonal and unitlngth. That maks Q an orthogonal matrix. For orthogonal matrics, th transpos of th matrix is th invrs of th matrix, so Q Q = QQ = I, th idntity matrix.