could anyone help me how to solve the issue for the following code

code:
N_UE=[4];
N_SC=[12];
Xmax=1
Ymax=1
radius=2
xsd=ones(1,N_UE)*Xmax
ysd=ones(1,N_UE)*Ymax
rrx=radius*sqrt(rand(1,N_UE))
thetarx=2*pi*rand(1,N_UE)
xrx=xsd+rrx.*cos(thetarx)
yrx=ysd+rrx.*sin(thetarx)
th = 0:pi/100:2*pi
xunit = radius * cos(th) + Xmax
yunit = radius * sin(th) + Ymax
figure
plot(xunit, yunit)
hold on
plot(ysd,xsd,'r^')
hold on
plot(yrx,xrx,'ko')
hold on
The above code works fine: i am getting the graph. Could anyone help me how to get the graph with respect to two different radius such that 4 users need to be present in total.

댓글 수: 1

This question barely differs from many of your 200+ questions recently. It's becoming clear that you are not attempting at all to troubleshoot your code and your using this platform as a means of other people fixing your code. You won't learn how to code or how to analyze data this way.

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

 채택된 답변

KSSV
KSSV 2018년 7월 23일
N_UE=[4];
N_SC=[12];
Xmax=1
Ymax=1
R=[2 3] ;
for i = 1:length(R)
radius = R(i) ;
xsd=ones(1,N_UE)*Xmax
ysd=ones(1,N_UE)*Ymax
rrx=radius*sqrt(rand(1,N_UE))
thetarx=2*pi*rand(1,N_UE)
xrx=xsd+rrx.*cos(thetarx)
yrx=ysd+rrx.*sin(thetarx)
th = 0:pi/100:2*pi
xunit = radius * cos(th) + Xmax
yunit = radius * sin(th) + Ymax
figure(1)
plot(xunit, yunit)
hold on
plot(ysd,xsd,'r^')
hold on
plot(yrx,xrx,'ko')
hold on
end

댓글 수: 6

ok.But in the graph the total number of N_UE seems to be 8. But what i actually need is the number of N_UE should be 4 which needs to be shared among two different radius.Could you please help me on this.
Not clear.
In the beginning of the code i have intialized N_UE=4,which indicates 4 number of users. So i want to have only 4 number of users which should be randomly scattered with respect to two different radius.
Where you want those users to lie?
they can be scattered randomly with respect to two different radius.
Please help me to get the graph in the attached form with respect to the code.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Polar Plots에 대해 자세히 알아보기

태그

질문:

2018년 7월 23일

댓글:

2018년 7월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by