How to modify the code to get my desired array?

If we keep 10 antennas at equal distance in a circle on XY-Plane, then their coordinates are given by the code given below:
function r=circularArray(N)
radius = 0.5/sind(180/N);
rx = radius*cosd(360*(0:N-1).'/N);
ry = radius*sind(360*(0:N-1).'/N);
r = [rx, ry, zeros(N,1)];
end
Here you just put value of N where N is the number of antennas. So if N=10, then the above code gives:
r =
1.6180 0 0
1.3090 0.9511 0
0.5000 1.5388 0
-0.5000 1.5388 0
-1.3090 0.9511 0
-1.6180 0 0
-1.3090 -0.9511 0
-0.5000 -1.5388 0
0.5000 -1.5388 0
1.3090 -0.9511 0
Now if I want to keep 9 antennas at same equal distance on x and y -axes separatelyi.e., 4 antennas along x-axis and and 4 antennas along y-axis where the inter-antenna distance is same between any two consective antennas and 1 antenna is placed on the origin. Then what change is to be done in the above code to get the desired geometry i.e., L-type geometry instead of circile?

 採用された回答

Torsten
Torsten 2022 年 7 月 14 日
編集済み: Torsten 2022 年 7 月 14 日

0 投票

N = 9;
d = 0.25;
rx = [(N-1)/2*d:-d:d,zeros(1,(N+1)/2)].';
ry = [zeros(1,(N+1)/2),d:d:(N-1)/2*d].';
r = [rx,ry,zeros(N,1)]
r = 9×3
1.0000 0 0 0.7500 0 0 0.5000 0 0 0.2500 0 0 0 0 0 0 0.2500 0 0 0.5000 0 0 0.7500 0 0 1.0000 0

8 件のコメント

Torsten
Torsten 2022 年 7 月 15 日
編集済み: Torsten 2022 年 7 月 15 日
Because you wanted to place your antennas on x- and y-axis with distance "d" of consecutive pairs (L-type geometry).
Torsten
Torsten 2022 年 7 月 15 日
編集済み: Torsten 2022 年 7 月 15 日
Further, normally distance is kept as d=0.5 but you have kept it 0.25, why?
Because I don't know what "normal" is.
I think in your circular arrangement, the antennas are also not 0.5 units apart from each other. Or is there a different rule for what is "normal" ?
Torsten
Torsten 2022 年 7 月 15 日
編集済み: Torsten 2022 年 7 月 15 日
I think with what I provided as code for the L-shape, it should be no problem for you to do it alone.
Torsten
Torsten 2022 年 7 月 15 日
What result do you want to get ?
0 0 0
1.0000 0 0
0.7500 0 0
0.5000 0 0
0.2500 0 0
0 1.0000 0
0 0.7500 0
0 0.5000 0
0 0.2500 0
0 0 1.0000
0 0 0.7500
0 0 0.5000
0 0 0.2500
?
Torsten
Torsten 2022 年 7 月 15 日
N = 4;
d = 0.25;
r = zeros(3*N+1,3);
v = (N*d:-d:d).';
r(2:N+1,1) = v;
r(N+2:2*N+1,2) = v;
r(2*N+2:3*N+1,3) = v;
r
r = 13×3
0 0 0 1.0000 0 0 0.7500 0 0 0.5000 0 0 0.2500 0 0 0 1.0000 0 0 0.7500 0 0 0.5000 0 0 0.2500 0 0 0 1.0000
Torsten
Torsten 2022 年 7 月 16 日
Strange, because you said in your previous post
I think its correct because when we look at x-coordinate, then both y and z must be zero.Likewise for y both x and z must be zero and for z, both x and y mus be zero. But where is the code?
But doesn't matter: If you had understood the code, you would have changed N = 4 to N = 1 and everything would have been fine.
Torsten
Torsten 2022 年 7 月 16 日
編集済み: Torsten 2022 年 7 月 16 日
N = 4;
d = 0.25;
N_on_each_axis = (N-1)/3;
r = zeros(3*N_on_each_axis+1,3);
v = (N_on_each_axis*d:-d:d).';
r(2:N_on_each_axis+1,1) = v;
r(N_on_each_axis+2:2*N_on_each_axis+1,2) = v;
r(2*N_on_each_axis+2:3*N_on_each_axis+1,3) = v;
r
r = 4×3
0 0 0 0.2500 0 0 0 0.2500 0 0 0 0.2500
But you have to make sure that N-1 is divisible by 3 !
Sadiq Akbar
Sadiq Akbar 2022 年 7 月 17 日
Thank you very much dear Torsten for your help.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeAntennas and Electromagnetic Propagation についてさらに検索

質問済み:

2022 年 7 月 14 日

コメント済み:

2022 年 7 月 17 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by