How to code for the following coordinates?

조회 수: 2 (최근 30일)
Sadiq Akbar
Sadiq Akbar 2022년 7월 21일
댓글: Sadiq Akbar 2022년 7월 21일
Let N denotes no. of antennas placed along an axis.Now if I have total 7 antennas i.e., N=7 and I place each antenna 0.5 apart on each axis, then if I want to place 3 antennas on x-axis, 3 antennas on y-axis and no antenna on z-axis, i.e., their co-ordinates are as below:
0 0 0
1.5000 0 0
1.0000 0 0
0.5000 0 0
0 1.5000 0
0 1.0000 0
0 0.5000 0
How will I code for this?

채택된 답변

Sadiq Akbar
Sadiq Akbar 2022년 7월 21일
I did it myself. So if any body needs it, here it is:
clear all
clc
N=11;%9;%7;
d=0.5;
r=zeros(N,3);
x=[0 d:d:(N-1)/2*d zeros(1,(N-1)/2)]';%x=[0 d 2*d 3*d 0 0 0]';%x=[0 0.5 1 1.5 0 0 0]';
y=[zeros(1,(N+1)/2) d:d:(N-1)/2*d]';%y=[0 0 0 0 d 2*d 3*d]';%y=[0 0 0 0 0.5 1 1.5]';
z=zeros(1,N)';%z=[0 0 0 0 0 0 0]';
r=[x y z]

추가 답변 (1개)

SAI SRUJAN
SAI SRUJAN 2022년 7월 21일
Hi Sadiq Akbar,
From my understanding of your question, you want to place a total of 3 antennas on x-axis, 3 antennas on y-axis and no antenna on z-axis.Im assuming that the 7th antenna is at origin.The following is a code snippet which generates the coordinates of the 7 antennas,
m=zeros(7,3);
d=0.5;
for i=2:4
m(i,1)=m(i-1,1)+d;
end
for i=5:7
m(i,2)=m(i-1,2)+d;
end
  댓글 수: 1
Sadiq Akbar
Sadiq Akbar 2022년 7월 21일
Thank you very much dear SAI SRUJAN for your help. But I have already done it and shared it above.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Analysis, Benchmarking, and Verification에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by