describe.m

来自「为了下载东西」· M 代码 · 共 76 行

M
76
字号
function Df = describe(ConTyp,A,W)
%function Df = describe(ConTyp,A,W)
%
% Describing function for Cart-Ball controllers
%
% ConTyp  Flag to point out controller type
%         1=linear cart, 2=linear ball, 3=rule cart
%         4=rule ball, 5=table cart, 6=table ball
% A       Input amplitudes (vector)
% W       Angular frequency (scalar)
% Df      1. harmonic (complex vector)

% Jantzen 940411

% Initialize;

load params ;

Step = 2*pi/50 ;
Wt = 0:Step:(2*pi) ;
Sincos = [sin(Wt'),W*cos(Wt')] ;
Df = zeros(length(A),1) ;

if ConTyp == 1,
  for N=1:length(A),
    U = (G1*A(N)*Sincos(:,1)) + (G2*A(N)*Sincos(:,2)) * GU1 ;
    % Rectangular integration ;
    Y = U' * Sincos * Step/pi ;
    Y = Y(:,1) + Y(:,2) * i ;
    Df(N) = Y/A(N) ;
  end;
elseif ConTyp == 2,
  for N=1:length(A),
    U = (G3*A(N)*Sincos(:,1)) + (G4*A(N)*Sincos(:,2)) * GU2 ;
    % Rectangular integration ;
    Y = U' * Sincos * Step/pi ;
    Y = Y(:,1) + Y(:,2) * i ;
    Df(N) = Y/A(N) ;
  end;
elseif ConTyp == 3,
  for N=1:length(A),
    U = carbase([G1*A(N)*Sincos(:,1), G2*A(N)*Sincos(:,2)]) * GU1 ;
    % Rectangular integration ;
    Y = U' * Sincos * Step/pi ;
    Y = Y(:,1) + Y(:,2) * i ;
    Df(N) = Y/A(N) ;
  end;
elseif ConTyp == 4,
  for N=1:length(A),
    U = ballbase([G3*A(N)*Sincos(:,1), G4*A(N)*Sincos(:,2)]) * GU2 ;
    % Rectangular integration ;
    Y = U' * Sincos * Step/pi ;
    Y = Y(:,1) + Y(:,2) * i ;
    Df(N) = Y/A(N) ;
  end;
elseif (ConTyp == 5) & ~isempty(Ftab1),
  for N=1:length(A),
    Gmat = [G1 0; 0 G2] ;
    U = GU1 * ftab(A(N)*Sincos*Gmat,Ftab1) ;
    % Rectangular integration ;
    Y = U' * Sincos * Step/pi ;
    Y = Y(:,1) + Y(:,2) * i ;
    Df(N) = Y/A(N) ;
  end;
elseif ConTyp == 6 & ~isempty(Ftab2),
  for N=1:length(A),
    Gmat = [G3 0; 0 G4] ;
    U = GU2 * ftab(A(N)*Sincos*Gmat,Ftab2) ;
    % Rectangular integration ;
    Y = U' * Sincos * Step/pi ;
    Y = Y(:,1) + Y(:,2) * i ;
    Df(N) = Y/A(N) ;
  end;
end ;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?