www.pudn.com > tfarma10.rar > param_tdfk.m, change:2004-01-19,size:3496b


function [TDFKnm, TDFKn0]= param_tdfk(Cnm, Initval)
% function [TDFKnm, TDFKn0]= param_tdfk(Cnm, Initval)
%   This file is part of the TFPM toolbox v1.0 (c)
%   michael.jachan@tuwien.ac.at and underlies the GPL.
% 
% Computes the Kamen roots [Kamen, LINALG, vol98, pp263, 1988] of
% a TV polynomial given through Cnm. If no initial value is 
% given (Initval==[]), the TDFR with minimum magnitude and phase is
% taken?. 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if(0)% TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear;tfpm;
MAR  =   0;
LAR  =   0;
MMA  =   3;
LMA  =   2;
N    = 256;
re_im= 'r';
mo_no= 'm';
tfpm_file_gen;
%-------------
Cml= Bml;
Cnm= param_ml_to_nm(Cml, N);
%Cnm= ones(N, 1)*BLTI;
Initval= [];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end;% TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Dimensions:
NM= size(Cnm);
N= NM(1);
M= NM(2)-1;

% TV Amplification factor
TDFKn0= [];% \parc{0}[0:N-1]
for n= 0:N-1
   cn0= Cnm(n+1, 1);% \parc{0}[n]
   Cnm(n+1, :)= Cnm(n+1, :)/cn0;
   TDFKn0= [TDFKn0; cn0];
end;

if(nargin==1)
   Initval= [];
end;

if(~M)%% Multiplier has no roots!
   TDFKnm= zeros(N, M);% \PORO{0:0}[0:N-1]
else
   if(M==1)%% Order-1 system has very simple roots!
      TDFKnm= -Cnm(:, 2);% \PORO{1:1}[0:N-1]= -\parc{1}[0:N-1]
   else
      if(isempty(Initval))
% Systen is TI prior to n= 0, takes min-root in abs and angle!!
%         Initval= sort(roots(Cnm(1, :)));Initval= Initval(end);%*ones(M-1, 1);
         Initval= j;
      end;

% The recursion
      if(M>2)
         PM= Initval*ones(M-1, 1);
         Enm= [];
         for n= 0:N-1
            eMM= 0;
            for MM= M-1:-1:1
               eMM= [eMM; double(( eMM(M-MM)-Cnm(n+1, 2+MM) )/PM(n+M-MM))];
            end;
            Enm= [Enm; [1; flipud(eMM(2:end))].'];
            PM= [PM; eMM(M)-Cnm(n+1, 2)];
         end;
         PM= PM(M:end);
         TDFKnm= [param_tdfk(Enm, Initval) PM];
      else%% The final step, M==2
         TDFKnm= [];
         for n= 0:N-1
            p1= Cnm(n+1, 3)/Initval;
            p2= -p1-Cnm(n+1, 2);
            Initval= p2;
            TDFKnm= [TDFKnm; [p1 p2]];
         end;
      end;%if(M>2)%% The recursion
   end;
end;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if(0)% TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
M= 3;
L= 2;
Cml= param_rand(M, L, N, 'i', 'n');
Cnm= param_ml_to_nm(Cml, N);

Initval= Cnm(N-M+2:N, end)
[TDFKnm, TDFKn0]= param_tdfk(Cnm, Initval);
figure(1);clf;tfpm_plot_roots(TDFKnm, max(1, max(max(abs(real(TDFKnm))))), ...
			              max(1, max(max(abs(imag(TDFKnm))))), 'x')
figure(2);clf;plot(real(TDFKnm8))
mesh(abs(TDFKnm2(N+1:end, :) - TDFKnm8(7*N+1:end, :)))

%[TDFKnm2, TDFKn02]= param_tdfk([Cnm;Cnm]);



M= 7;
L= 5;
Cml= param_rand(M, L, N, 'i', 'n');
Cnm= param_ml_to_nm(Cml, N);
[TDFKnm81, TDFKn08]= param_tdfk([Cnm;Cnm;Cnm], j*randn);
[TDFKnm82, TDFKn08]= param_tdfk([Cnm;Cnm;Cnm], j*randn);
figure(1);clf;plot(abs(TDFKnm81))
figure(2);clf;plot(abs(TDFKnm82))
figure(3);clf;plot(abs(TDFKnm82(2*N+1:end, :)-TDFKnm81(2*N+1:end, :)))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end;% TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%