% Askhsh thewrias elegxou 2013
% gh, 5-4-2013

%
  r0=sym('r0'); % orizoume symbolikh metablhth w0
  w0=sym('w0'); % orizoume symbolikh metablhth w0
  t=sym('t');   % symbolikh metablhth xronou
%
% Pinakas a:
%
  a=[0 1 0 0;
     3*w0^2 0 0 2*r0*w0;
     0 0 0 1;
     0 -2*w0/r0 0 0];
%
% Pinakas B
  b = [0 0;
       1 0;
       0 0;
       0 1/r0];
%
%--------------------------------------------------------------------------
% Jordan morfh pinaka:
%
  [v,j]=jordan(a)
% 
% Genikeymena idiodianysmata: 
%  
% v = [          0,          4,       -3/2,        -3/2]
%     [          0,          0, (3*i*w0)/2, -(3*i*w0)/2]
%     [ -(6*w0)/r0,          0,   (3*i)/r0,   -(3*i)/r0]
%     [          0, -(6*w0)/r0,  (3*w0)/r0,   (3*w0)/r0]
%  
% kai pinakas jordan me idiotimes (0,0,-i*om_0,i*om_0):
%  
% j = [ 0, 1,     0,    0]
%     [ 0, 0,     0,    0]
%     [ 0, 0, -i*w0,    0]
%     [ 0, 0,     0, i*w0]

% Epibebaiwsh apotelesmatos:
%
  v*j*inv(v)-a
%
% ans = [ 0, 0, 0, 0]
%       [ 0, 0, 0, 0]
%       [ 0, 0, 0, 0]
%       [ 0, 0, 0, 0]
%
%--------------------------------------------------------------------------
% Ekthetikos pinakas exp(At)
%
  exp_at=expm(a*t);
  exp_at=simplify(exp_at) 
% 
% exp_at = [               4 - 3*cos(t*w0),                 sin(t*w0)/w0, 0, (4*r0*sin((t*w0)/2)^2)/w0]
%          [                3*w0*sin(t*w0),                    cos(t*w0), 0,            2*r0*sin(t*w0)]
%          [ (3*(2*sin(t*w0) - 2*t*w0))/r0, -(4*sin((t*w0)/2)^2)/(r0*w0), 1,    (4*sin(t*w0))/w0 - 3*t]
%          [   -(12*w0*sin((t*w0)/2)^2)/r0,            -(2*sin(t*w0))/r0, 0,           4*cos(t*w0) - 3]
%  
%--------------------------------------------------------------------------
