pv2params.m 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. %%
  2. %% Copyright 2007, Aaron Heller, All Rights Reserved
  3. %% heller@ai.sri.com
  4. %%
  5. %% This program is free software: you can redistribute it and/or modify
  6. %% it under the terms of the GNU General Public License as published by
  7. %% the Free Software Foundation, either version 3 of the License, or
  8. %% (at your option) any later version.
  9. %%
  10. %% This program is distributed in the hope that it will be useful,
  11. %% but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. %% GNU General Public License for more details.
  14. %%
  15. %% You should have received a copy of the GNU General Public License
  16. %% along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. function pv2params (pv)
  18. fprintf('mic\t sens\t dir\t fbr\t az\t el\n');
  19. for i = 1:size(pv,1)
  20. p = pv(i,1);
  21. v = pv(i,2:4);
  22. s = ( p + norm(v) )/ 2;
  23. d = norm(v) / ( norm(v) + p );
  24. fbr = (p+norm(v)) / (p-norm(v));
  25. fbr_sign = sign(fbr);
  26. fbr_dB = 20 * log10( abs(fbr) );
  27. o = v / norm(v);
  28. az_el_rad = [ atan2( o(2), o(1) ) asin( o(3) ) ];
  29. az_el_deg = 180/pi * az_el_rad;
  30. fprintf('%5g\t %5g\t %5g\t %5g\t %5g\t %5g\n', ...
  31. i, s, d, fbr_dB, az_el_deg(1), az_el_deg(2));
  32. end
  33. end