Advertisement
makispaiktis

Eidikes - Ergasia 1 - createCoordinates3.m

Mar 28th, 2021 (edited)
891
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 3.38 KB | None | 0 0
  1. clear all
  2. clc
  3.  
  4. % ========================================================================
  5. % ================================= Data =================================
  6. % ========================================================================
  7. lamda = 0.1;
  8. f = 3000;        % Mhz, due to 0.1m wavelength
  9. N = 8;
  10. theta = 0 : 2*pi/N : 2*pi - 2*pi / N;
  11. diameter = lamda / 100;
  12. segments = 9;
  13. % Δίσκος
  14. rDisc = 0.3 * lamda;
  15. % Κώνος
  16. l = 0.5 * lamda;
  17. theta0 = pi/6;
  18. rCone = l * sin(pi/6);
  19. h = l * cos(pi/6);
  20. % Μεσαίο segment τροφοδοσίας
  21. offsetZ = lamda / 20;
  22.  
  23.  
  24. % ========================================================================
  25. % ============================== Coordinates =============================
  26. % ========================================================================
  27. % 1. Συντεταγμένες αρχής δίσκου
  28. xDiscStart = [];
  29. yDiscStart = [];
  30. zDiscStart = [];
  31. for i = 1:2
  32.     xDiscStart(i) = 0;
  33.     yDiscStart(i) = 0;
  34.     zDiscStart(i) = 0;
  35. end
  36.  
  37.  
  38. % 2. Συντεταγμένες τέλους δίσκου
  39. xDiscEnd = [];
  40. yDiscEnd = [];
  41. zDiscEnd = [];
  42. xDiscEnd(1) = 0;
  43. yDiscEnd(1) = rDisc;
  44. zDiscEnd(1) = 0;
  45. xDiscEnd(2) = 0;
  46. yDiscEnd(2) = -rDisc;
  47. zDiscEnd(2) = 0;
  48.  
  49. % 3. Συντεαταγμένες αρχής κώνου
  50. xConeStart = [];
  51. yConeStart = [];
  52. zConeStart = [];
  53. for i = 1:N
  54.     xConeStart(i) = 0;
  55.     yConeStart(i) = 0;
  56.     zConeStart(i) = offsetZ;
  57. end
  58.  
  59. % 4. Συντεταγμένες τέλους κώνου
  60. xConeEnd = [];
  61. yConeEnd = [];
  62. zConeEnd = [];
  63. a = (pi / 6) / (N-1);
  64. for i = 1:N
  65.     xConeEnd(i) = 0;
  66. end
  67. for i = 1:2:N-1               % i = 1,3,5,7
  68.     zConeEnd(i) = l * cos(a/2 + (i-1)*a);
  69.     zConeEnd(i+1) = l * cos(a/2 + (i-1)*a);
  70.     yConeEnd(i) = l * sin(a/2 + (i-1)*a);
  71.     yConeEnd(i+1) = - l * sin(a/2 + (i-1)*a);
  72. end
  73.  
  74. xConeEnd
  75. yConeEnd
  76. zConeEnd
  77.  
  78.  
  79. % ========================================================================
  80. % ================================ fprintf ===============================
  81. % ========================================================================
  82. geometryFile = fopen('ErgasiaFullFlat.nec', 'w');
  83. % Αρχή .nec αρχείου
  84. fprintf(geometryFile, 'CM Disc-cone antenna Question D: 8 wires for disc and 8 more for cone\n');
  85. fprintf(geometryFile, 'CM Boufikos Thomas 9360\nCE\n\n');
  86. % Δίσκος
  87. format = 'GW %d %d %f %f %f %f %f %f %f\n';
  88. for i = 1:2
  89.     fprintf(geometryFile, format, i, segments, xDiscStart(i), yDiscStart(i), zDiscStart(i), xDiscEnd(i), yDiscEnd(i), zDiscEnd(i), diameter/2);
  90. end
  91. % Κώνος
  92. format = 'GW %d %d %f %f %f %f %f %f %f\n';
  93. for i = 1:N
  94.     fprintf(geometryFile, format, i+N, segments, xConeStart(i), yConeStart(i), zConeStart(i), xConeEnd(i), yConeEnd(i), zConeEnd(i), diameter/2);
  95. end
  96. % Μεσαίο segment τροφοδοσίας
  97. xFeedStart = 0;
  98. yFeedStart = 0;
  99. zFeedStart = 0;
  100. xFeedEnd = 0;
  101. yFeedEnd = 0;
  102. zFeedEnd = lamda/20;
  103. format = 'GW %d %d %f %f %f %f %f %f %f\n';
  104. segmentsFeed = 1;
  105. fprintf(geometryFile, format, N+N+1, segmentsFeed, xFeedStart, yFeedStart, zFeedStart, xFeedEnd, yFeedEnd, zFeedEnd, diameter/2);
  106.  
  107. % Λοιπές λεπτομέρειες
  108. isThereGround = 0;
  109. fprintf(geometryFile, '\n\nGE %d\n', isThereGround);
  110. fprintf(geometryFile, 'EX 0 %d %d 0 1 0\n', N+N+1, segmentsFeed);
  111. fprintf(geometryFile, 'FR 0 1 0 0 %d 0\n\n', f);
  112. fprintf(geometryFile, 'EN');
  113.  
  114. fclose(geometryFile);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement