Advertisement
makispaiktis

Sfairikothta - tanpsi

Nov 18th, 2021 (edited)
780
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.74 KB | None | 0 0
  1. clear all
  2. clc
  3.  
  4. % MAIN FUNCTION
  5. h1List = [687, 1524, 1210, 1539];
  6. h2List = [145, 120, 410, 570];
  7. for i = 1:length(h1List)
  8.     h1 = h1List(i);
  9.     h2 = h2List(i);
  10.     dmax = calculate(h1, h2);
  11. end
  12.  
  13. % Auxiliary Function
  14. % Data
  15. function dmax = calculate(h1, h2)
  16.     h1_antenna = 25;
  17.     h1_all = h1 + h1_antenna;
  18.     h2_antenna = 6;
  19.     h2_all = h2 + h2_antenna;
  20.     % Formula: tan(ψ) = (h1_all + h2_all) / d
  21.     syms d
  22.     d1 = d * (h1_all / (h1_all + h2_all));
  23.     d2 = d * (h2_all / (h1_all + h2_all));
  24.     h1_tonos = h1_all - d1^2 / 12.7;
  25.     h2_tonos = h2_all - d2^2 / 12.7;
  26.     % LOS
  27.     d_LOS = 3.57 * (sqrt(h1_tonos) + sqrt(h2_tonos));
  28.     eqn = d_LOS == d;
  29.     % Solving
  30.     dmax = solve(eqn, d);
  31.     dmax = vpa(dmax)
  32. end
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement