home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 3.ddi / MMLE3.DI$ / ML_P2SS1.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  2.4 KB  |  52 lines

  1. function [a,phi,gam,c,d,q,x0,dt,rowinq,b]=ml_p2ss1(p)
  2.  % Original parameter vector was [-1 10 1 0 2 0 .01]
  3. rowinq=[0 0 0 0 1 0 0];
  4. dt=p(7);  a=p(1);  b=p(2);  c=p(3);  d=p(4);  f=p(5);
  5. q=f*sqrt(dt);%    SAME SIZE AS a
  6. x0=p(6);%         ROW VECTOR
  7.  %following two lines from c2d.m
  8. [m,n] = size(a);[m,nb] = size(b);s = expm([[a b]*dt; zeros(nb,n+nb)]);
  9. phi = s(1:n,1:n);gam = s(1:n,n+1:n+nb);
  10. return
  11. %---------------------------------------------------------------------------
  12. %                      p2ss  function for ml_demo1.m
  13. %                TESTCASE 1, Maine and Iliff,  NASA TP1690
  14. %---------------------------------------------------------------------------
  15. %                             DOCUMENTATION
  16. %
  17. %From input vector p, this function must return a,phi,gam,c,d,q,x0,dt,rowinq,b
  18. %NOTE All program variables are LOWER CASE.
  19. %
  20. % Continuous state eqn :   Xdot   = a   * X     +  b * U       +  f * en
  21. %
  22. %       Is modeled by :   X(n+1) = phi * X(n)  +  gam * U(n)  +  q * es(n)
  23. %                          X(0)   = x0 (row vector)
  24. %
  25. % The measurement equation is
  26. %
  27. %            Y(n)   = c * X(n)  +  d * U(n)  +  scriptgg * eta(n)
  28. %  where
  29. %          en   has unit spectral density.
  30. %     es, eta   are independent unit covariance random processes.
  31. %         q_q   is the State Noise Covariance. Note - is same size as a
  32. %           q   chol(q_q)-- is usually assumed diagonal.
  33. %     phi,gam   are obtained from [phi,gam]=c2d(a,b,dt)
  34. %    scriptgg   (measurement noise covariance)-unused.  MMLE.M uses the
  35. %               guessed or estimated innovations covariance and f.
  36. %
  37. %  " a " must be  returned to solve the K.F. eqns in terms of INNOVATIONS
  38. %        covariance and state noise covariance. "b" is for convenience.
  39. %
  40. %  Rowinq is a vector of same dimension as p, and gives the row in q in which
  41. %        each parameter appears, else 0.
  42. %
  43. %  NOTE : If q is zeros, a zero Kalman gain is used, even if 'a' is unstable
  44. %
  45. %  NASA TP 1690 specifies the state equations in continuous form, using f for
  46. %        the square root of the power spectral density of the state noise.
  47. %        The discrete equivalent is then computed as   qq' = ff' * dt.
  48. %        MMLE.M uses q directly.  This is more convenient when simulating
  49. %        data and estimating effects of a-d conversion noise on input data.
  50. %--------------------------------------------------------------- end p2ssim
  51.  
  52.