MATLAB: Could anyone help me how to solve the issue for the following code

graph

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.

Best Answer

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
Related Question