Skip to content
Snippets Groups Projects
Commit f05c8202 authored by Axel Schnitger's avatar Axel Schnitger
Browse files

Added two new m-files.

parent b8b5d734
No related branches found
No related tags found
No related merge requests found
Ri2e.m 0 → 100644
function RotMati2e = Ri2e(grace_gps_time)
% This function returns the rotation matrix from a (pseudo) inertial frame
% to an Earth-fixed Earth-centered coordinate system. The rotation matrix
% is a simple Z-rotation, in which the rotation axes of the inertial and
% the Earth-fixed frames coincide. It is an approximation of the realistic
% rotation matrix, by neglecting the contribuiton of the Precession,
% Nutation and polar motion.
% INPUT arguments:
% time in GRACE GPS seconds, with size N*1 in which N is the number of time stamps.
% OUTPUT:
% N*3*3 array
% Example:
% grace_gps_time = 281361600
% RotMati2e = 0.341262285804206 0.939968112378121 0
% -0.939968112378121 0.341262285804206 0
% 0 0 1
% Written by Majid Naeimi, August 2015, IfE, Germany
% Contact: naeimi@ife.uni-hannover.de
% Caution: This matrix shall be used only for simulation purposes, in
% particular along with the simulated data available at:
% https://www.geoq.uni-hannover.de/mock.html
Tjd = grace_gps_time/86400 + 2451545;
sdt = (Tjd-2453491.5) * 86400 * 7.29211514670698e-05 - 2.46276246875459;
rot_mat = [cos(sdt) -sin(sdt) zeros(length(sdt),1)...
sin(sdt) cos(sdt) zeros(length(sdt),1)...
zeros(length(sdt),1) zeros(length(sdt),1) ones(length(sdt),1)];
RotMati2e = reshape(rot_mat',3,3,[]);
Ri2srf.m 0 → 100644
function RotMat_i2srf = Ri2srf(Q)
% this function computes the rotation matrix from inertial frame to
% satellite reference frame (SRF) based on the given quatrnions Q.
%
% INPUT:
% quaterninons Q = [Q1, Q2, Q3, Q4] ... where Q4 = Q0 = cos(phi/2)
% ... size(Q) = n x 4
% OUTPUT:
% rotation matrix RotMat_i2srf = [3 x 3 x n]
% Written at IfE, Hannover, Germany, April 2010.
% Contact: naeimi@ife.uni-hannover.de
[a, ~] = size(Q);
q = Q';
AA11= q(1,:).^2 -q(2,:).^2 -q(3,:).^2 +q(4,:).^2;
AA12= 2* (q(1,:).*q(2,:) + q(3,:).*q(4,:));
AA13= 2* (q(1,:).*q(3,:) - q(2,:).*q(4,:));
AA21= 2* (q(1,:).*q(2,:) - q(3,:).*q(4,:));
AA22= -q(1,:).^2 +q(2,:).^2 -q(3,:).^2 +q(4,:).^2;
AA23= 2* (q(2,:).*q(3,:) + q(1,:).*q(4,:));
AA31= 2* (q(1,:).*q(3,:) + q(2,:).*q(4,:));
AA32= 2* (q(2,:).*q(3,:) - q(1,:).*q(4,:));
AA33= -q(1,:).^2 -q(2,:).^2 +q(3,:).^2 +q(4,:).^2;
RotMat_i2srf = zeros(3,3,a);
RotMat_i2srf(1,1,:) = AA11;
RotMat_i2srf(1,2,:) = AA12;
RotMat_i2srf(1,3,:) = AA13;
RotMat_i2srf(2,1,:) = AA21;
RotMat_i2srf(2,2,:) = AA22;
RotMat_i2srf(2,3,:) = AA23;
RotMat_i2srf(3,1,:) = AA31;
RotMat_i2srf(3,2,:) = AA32;
RotMat_i2srf(3,3,:) = AA33;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment