ufrgs-gnss-lab / geo-alhazen

Modeling of reflection on a sphere
1 stars 0 forks source link

Support multiple antenna height #16

Closed fgnievinski closed 2 years ago

fgnievinski commented 2 years ago

implemented for Fujimura, needs to be done for other algorithms.

main change is positions are returned with coordinate in separate variables.

geo-alhazen.20210929fgn.zip

demo:

e_dom = 1:5:90;
Ha_dom = [10 50 100 200 300 500 1000];
[e_grid, Ha_grid] = meshgrid(e_dom, Ha_dom);

[Di, g, arclen, sldist, xspec, yspec] = get_reflection_spherical (e_grid, Ha_grid);

figure, imagesc(e_dom, Ha_dom, Di)
xlabel('Sat. Elev. (deg.)')
ylabel('Ant. Height (h)')
title('Interf. delay (m)')
grid on
set(gca(), 'YDir','normal')

image

vitorhjr commented 2 years ago

Is not it better to create grids from the domain inside the function?

vitorhjr commented 2 years ago

I saw that you tried to build a struct of output variables on Fujimura's function. Do you think it is worth?

pos_spec = struct();
pos_spec.X = pos_spec_geo(:,1);
pos_spec.Y = pos_spec_geo(:,2);
pos_spec.x = pos_spec_loc(:,1);
pos_spec.y = pos_spec_loc(:,2);
pos_spec.geo = pos_spec_geo;
pos_spec.loc = pos_spec_loc;
vitorhjr commented 2 years ago

I have released the follow functions:

From releases, the following functions were set unused and should be deleted:

geo-alhazen-multh_revVitor.zip

fgnievinski commented 2 years ago

Is not it better to create grids from the domain inside the function?

no, because sometimes the user wants just the combinations along the grid diagonal line, instead of the whole grid with all combinations.

fgnievinski commented 2 years ago

I saw that you tried to build a struct of output variables on Fujimura's function. Do you think it is worth?

I contemplated using structures but decided against them because they are difficult to concatenate when comparing results from different algorithms.

fgnievinski commented 2 years ago

I've made the following changes in get_spherical_reflection.m:

I've also changed:

I've uploaded the new code in a separate branch titled "multh": https://github.com/vitorhjr/geo-alhazen/tree/multh The old main trunk remains available separately: https://github.com/vitorhjr/geo-alhazen/tree/main When we're done, we can merge the branch into the trunk.

Now please do:

vitorhjr commented 2 years ago
vitorhjr commented 2 years ago

I've done some changes in the first demo as follow:

I observed the first demo runs an elevation for each height. The code runs this for each algorithm. For each algorithm loop, only the diagonal elements of the matrix are correct whose we want only results on the spherical horizon.

Currently, the code section of the loop is:

for i=1:n
    Ha = Has(i);
    ehor = ehors(i);
    for j=1:m
        algorithm = algs{j};
        [Di(i,j), g(i,j), arclen(i,j), sldist(i,j), Xspec(i,j),Yspec(i,j)]...
            = get_reflection_spherical (ehor, Ha, [], [], algorithm);
    end
end

I suggest the following:

for i=1:m
    algorithm = algs{i};
    [Di_aux, g_aux, arclen_aux, sldist_aux, Xspec_aux, Yspec_aux]...
            = get_reflection_spherical (e_grid, Ha_grid, [], [], algorithm);

     [Di(:,i), g(:,i), arclen(:,i), sldist(:,i), Xspec(:,i), Yspec(:,i)] ...
         = get_diag(Di_aux, g_aux, arclen_aux, sldist_aux, Xspec_aux, Yspec_aux);
end

Where _getdiag is a local function:

function [Di, g, arclen, sldist, Xspec, Yspec] = get_diag(Di_aux, g_aux, arclen_aux, sldist_aux, Xspec_aux, Yspec_aux)
     Di = diag(Di_aux).'; 
     g = diag(g_aux).';
     arclen= diag(arclen_aux).';
     sldist= diag(sldist_aux).';
     Xspec= diag(Xspec_aux).';
     Yspec= diag(Yspec_aux).';
end

Is it good @fgnievinski?

fgnievinski commented 2 years ago

you can input the diagonal vectors directly:

    for j=1:m
        algorithm = algs{j};
        [Di(i,j), g(i,j), arclen(i,j), sldist(i,j), Xspec(i,j),Yspec(i,j)]...
            = get_reflection_spherical (ehors(:), Has(:), [], [], algorithm);
    end

after all, "matrix input may also be a vector or a scalar": https://github.com/vitorhjr/geo-alhazen/blob/cb7f86693ba571cc95a55e6f1edf1dac1836b60e/get_reflection_spherical.m#L9

vitorhjr commented 2 years ago

You're correct. I thought of the input only as a matrix.

vitorhjr commented 2 years ago

New releases in the first demo on the commit f3a58a1753cb98155cccc08abc42cc94c0420cd1. I've made the following main changes: