% [gse] = gea2gse_a(gea) transformas attitude matrix from GEA(J2000) to GSE 
%
% Initial version: Magnus Billvik, Swedish Institute of Space Physics,
%Uppsala, June 2005
% Revised by: Niklas Edberg, Swedish Institute of Space Physics, Uppsala, Oct 2005

function [gse] = gea2gse_a(gea, rs_gea)

gse=ones([1 3 length(gea)]);    % declare the variabel before to speed up the loop!

longitude=atan2(rs_gea(2,:),rs_gea(1,:));   % angle between x-axis and the sun

for i=1:length(gea)
    T=R(longitude(i));
    gse(1,:,i)=(T*gea(1,:,i)');
end