annotate ddm_lin_sys.m @ 4:72c011ed1977 tip

more elaborate example with non-stat. estimate explanation
author smusevic
date Tue, 30 Jul 2013 09:56:27 +0100
parents a4a7e3405062
children
rev   line source
dan@0 1 % constructs the linear system of equations using distribution derivative rule
dan@0 2 function [A,b] = ddm_lin_sys(krnls, krlns_ders, mf_ders, sig, N)
dan@0 3 %generic multi-frequency distribution derivative based estimator for
dan@0 4 % non-stationary sinusoidal analysis
dan@0 5 %
dan@0 6 %
dan@0 7 % [1] Michael Betser: Sinusoidal Polynomial Estimation Using The Distribution
dan@0 8 % Derivative, in IEEE Transactions on Signal Processing, Vol.57, Nr. 12,
dan@0 9 % December 2009
dan@0 10 %
dan@0 11 % krnls: matrix of all the kernels... N x R , where R is the number of
dan@0 12 % non-static parameters to estimate and at the same time, the number
dan@0 13 % of kernels
dan@0 14 %
dan@0 15 % krlns_ders: matrix of all the kernel time derivatives... N x R , where R
dan@0 16 % is the number of non-static parameters to estimate and at the same
dan@0 17 % time, the number of kernels
dan@0 18 %
dan@0 19 % mf_ders: matrix of all the model function time derivatives... N x Q , where Q
dan@0 20 % is the number of model functions
dan@0 21 %
dan@0 22 %
dan@0 23 % sig: vector - signal, N x 1 (CAUTION: MUST be column vector!!!)
dan@0 24 %
dan@0 25 % N: odd integer - signal buffer length, ...
dan@0 26 %
dan@0 27 % For any reasonable use, Q equals R, otherwise it makes little sense.
dan@0 28 % Kernels must include the window function...
dan@0 29 %
dan@0 30
dan@0 31 R = size(krnls,2);
dan@0 32 Q = size(mf_ders,2);
dan@0 33 assert(R == size(krlns_ders, 2) );
dan@0 34 assert(R >= Q);
dan@0 35 % constructing the matrixes A and B from equation III.4 in [1]
dan@0 36 % 1st dimension is the discrete time
dan@0 37
dan@0 38 sig_mat = repmat(sig, [1,R,Q]);
dan@0 39 krnls_mat = repmat(krnls, [1,1,Q]);
dan@0 40
dan@0 41 mf_ders_mat = repmat(reshape(mf_ders,[N,1,Q]),[1,R,1]);
dan@0 42
dan@0 43 % inner product for left and right hand side of the eq.
dan@0 44 A = shiftdim(sum( conj(krnls_mat) .* mf_ders_mat .* sig_mat, 1), 1);
dan@0 45 b = shiftdim(sum(- conj(krlns_ders) .* sig_mat(:,:,1), 1), 1);
dan@0 46
dan@0 47 end