Skip to content
Snippets Groups Projects
Select Git revision
  • 897f433b33a46d56cc6972b1c6b4405ecaa4dea9
  • master default protected
  • legacy
  • jdk-17.0.13-ga-legacy
  • jdk-17.0.14+4
  • jdk-17.0.14+3
  • jdk-17.0.14+2
  • jdk-17.0.14+1
  • jdk-17.0.13-ga
  • jdk-17.0.13+11
  • jdk-17.0.13+10
  • jdk-17.0.13+9
  • jdk-17.0.13+8
  • jdk-17.0.13+7
  • jdk-17.0.13+6
  • jdk-17.0.14+0
  • jdk-17.0.13+5
  • jdk-17.0.13+4
  • jdk-17.0.13+3
  • jdk-17.0.13+2
  • jdk-17.0.13+1
  • jdk-17.0.13+0
  • jdk-17.0.12-ga
23 results

Foo.java

Blame
  • designmatrixn.m 1.07 KiB
    function A = designmatrixn(longitude,latitude,height,n_max,GM,R)
    %
    % Calculation of normalized Legendre Functions using stable recursion
    % formulas. 
    %
    % --Input--
    %   longitude     Longitudes (n x 1) in Radian
    %   latitudes     Latitudes (n x 1)  in Radian
    %   height        Heights (n x 1)
    %   n_max         Maximum degree (1 x 1)
    %   GM            Gravitational constant times mass of the Earth
    %   R             Radius of the Earth
    %
    % --Output--
    %   A             Design matrix (n x n_max)
    %
    % Author: Anne Springer
    % Date:  2015-08-24
    %
    
    % Degree and order
    idx = tril(ones(n_max+1))~=0;
    degree = repmat((0:n_max)',1,n_max+1);
    degree = degree(idx);
    order = repmat(0:n_max,n_max+1,1);
    order = order(idx);
    
    % Design matrix
    A = zeros(length(longitude),length(degree)*2-(n_max+1));
    for i = 1:length(A)
        Pnm = calculatePnm((pi/2-latitude(i)), n_max);
        Pnm = Pnm(idx);
        factor = GM/R*(R/height(i)).^(degree+1);
        cos_ = cos(order*longitude(i));
        sin_ = sin(order*longitude(i));
        A(i,:) = [factor.*cos_.*Pnm; factor(n_max+2:end).*sin_(n_max+2:end).*Pnm(n_max+2:end)]';
    end