Advertisement
makispaiktis

Eidikes - Ergasia1 - createCoordinates.m

Mar 27th, 2021 (edited)
555
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 3.41 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 = 5;
  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:N
  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. for i = 1:N
  43.     zDiscEnd(i) = 0;
  44.     xDiscEnd(i) = rDisc * cos(theta(i));
  45.     yDiscEnd(i) = rDisc * sin(theta(i));
  46. end
  47. display('Disc coordinates done');
  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. for i = 1:N
  64.     zConeEnd(i) = offsetZ + h;
  65.     xConeEnd(i) = rCone * cos(theta(i));
  66.     yConeEnd(i) = rCone * sin(theta(i));
  67. end
  68. display('Cone coordinates done');
  69.  
  70. % ========================================================================
  71. % ================================ fprintf ===============================
  72. % ========================================================================
  73. geometryFile = fopen('MyErgasia.nec', 'w');
  74. % Αρχή .nec αρχείου
  75. fprintf(geometryFile, 'CM Disc-cone antenna: 8 wires for disc and 8 more for cone\n');
  76. fprintf(geometryFile, 'CM Boufikos Thomas 9360\nCE\n\n');
  77. % Δίσκος
  78. format = 'GW %d %d %f %f %f %f %f %f %f\n';
  79. % fprintf(geometryFile, 'CM Disc Data\n');
  80. for i = 1:N
  81.     fprintf(geometryFile, format, i, segments, xDiscStart(i), yDiscStart(i), zDiscStart(i), xDiscEnd(i), yDiscEnd(i), zDiscEnd(i), diameter/2);
  82. end
  83. % Κώνος
  84. format = 'GW %d %d %f %f %f %f %f %f %f\n';
  85. % fprintf(geometryFile, '\nCM Cone Data\n');
  86. for i = 1:N
  87.     fprintf(geometryFile, format, i+N, segments, xConeStart(i), yConeStart(i), zConeStart(i), xConeEnd(i), yConeEnd(i), zConeEnd(i), diameter/2);
  88. end
  89. % Μεσαίο segment τροφοδοσίας
  90. % fprintf(geometryFile, '\nCM Feed Segment\n');
  91. xFeedStart = 0;
  92. yFeedStart = 0;
  93. zFeedStart = 0;
  94. xFeedEnd = 0;
  95. yFeedEnd = 0;
  96. zFeedEnd = lamda/20;
  97. format = 'GW %d %d %f %f %f %f %f %f %f\n';
  98. segmentsFeed = 1;
  99. fprintf(geometryFile, format, N+N+1, segmentsFeed, xFeedStart, yFeedStart, zFeedStart, xFeedEnd, yFeedEnd, zFeedEnd, diameter/2);
  100.  
  101. % Λοιπές λεπτομέρειες
  102. isThereGround = 0;
  103. fprintf(geometryFile, '\n\nGE %d\n', isThereGround);
  104. fprintf(geometryFile, 'EX 0 %d %d 0 1 0\n', N+N+1, segmentsFeed);
  105. fprintf(geometryFile, 'FR 0 1 0 0 %d 0\n\n', f);
  106. fprintf(geometryFile, 'EN');
  107. display('All data transfered');
  108.  
  109. fclose(geometryFile);
  110.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement