annotate toolboxes/FullBNT-1.0.7/Kalman/SS_to_AR.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function [coef, C] = SS_to_AR(F, Q, k, diagonal)
Daniel@0 2 %
Daniel@0 3 % Extract the parameters of a vector autoregresssive process of order k from the state-space form.
Daniel@0 4 % [coef, C] = SS_to_AR(F, Q, k, diagonal)
Daniel@0 5
Daniel@0 6 if nargin<4, diagonal = 0; end
Daniel@0 7
Daniel@0 8 s = length(Q) / k;
Daniel@0 9 bs = s*ones(1,k);
Daniel@0 10 coef = zeros(s,s,k);
Daniel@0 11 for i=1:k
Daniel@0 12 if diagonal
Daniel@0 13 coef(:,:,i) = diag(diag(F(block(1,bs), block(i,bs))));
Daniel@0 14 else
Daniel@0 15 coef(:,:,i) = F(block(1,bs), block(i,bs));
Daniel@0 16 end
Daniel@0 17 end
Daniel@0 18 C = Q(block(1,bs), block(1,bs));
Daniel@0 19 if diagonal
Daniel@0 20 C = diag(diag(C));
Daniel@0 21 end
Daniel@0 22 %C = sqrt(Q(block(1,bs), block(1,bs))); % since cov(1,1) of full vector = C C'