From 7bc77cb1ed33745c720952c92b3b2747c5cbf2df Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Sat, 3 Feb 2018 11:01:52 +0530 Subject: Added new code --- 2048/DEPENDENCIES/specfac.sci | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 2048/DEPENDENCIES/specfac.sci (limited to '2048/DEPENDENCIES/specfac.sci') diff --git a/2048/DEPENDENCIES/specfac.sci b/2048/DEPENDENCIES/specfac.sci new file mode 100644 index 000000000..1a8ff1332 --- /dev/null +++ b/2048/DEPENDENCIES/specfac.sci @@ -0,0 +1,34 @@ +// Spectral factorization, to solve Eq. 13.47 on page 471. +// 13.3 + +// function [r,b,dAFW] = ... +// specfac(A,degA,B,degB,rho,V,degV,W,degW,F,degF) +// Implements the spectral factorization for use with LQG control +// design method of Ahlen and Sternard + +function [r,b,dAFW] = ... + specfac(A,degA,B,degB,rho,V,degV,W,degW,F,degF) +AFW = convol(A,convol(W,F)); +dAFW = degA + degF + degW; +AFWWFA = rho * convol(AFW,flip(AFW)); +BV = convol(B,V); +dBV = degB + degV; +BVVB = convol(BV,flip(BV)); +diff1 = dAFW - dBV; +dBVVB = 2*dBV; +for i = 1:diff1 + [BVVB,dBVVB] = polmul(BVVB,dBVVB,[0 1],1); +end +[rbb,drbb] = poladd(AFWWFA,2*dAFW,BVVB,dBVVB); +Rbb = polyno(rbb,'z'); +rts = roots(Rbb); +rtsin = rts(dAFW+1:2*dAFW); +b = 1; +for i = 1:dAFW, + b = convol(b,[1 -rtsin(i)]); +end +b = real(b); +br = flip(b); +bbr = convol(b,br); +r = rbb(1) / bbr(1); +endfunction; -- cgit