Effacer les filtres
Effacer les filtres

could anyone help me to measure the distance between base station and users with respect to the following code.

6 vues (au cours des 30 derniers jours)
code:
user=[6];
for t = 1:length(user)
Xmax=1;
Ymax=1;
radius=2;
xsd=ones(1,user(t))*Xmax;
ysd=ones(1,user(t))*Ymax;
rrx=radius*sqrt(rand(1,N_UE(t)));
thetarx=2*pi*rand(1,N_UE(t));
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 code executes and gives me the figure.
With respect to the figure i need to measure the distance between all users with respect to the base station.
Could anyone please help me how to measure it.
  3 commentaires

Connectez-vous pour commenter.

Réponses (1)

KSSV
KSSV le 7 Fév 2019
user=6;
d1 = zeros(user,1) ;
d2 = zeros(user,1) ;
for t = 1:length(user)
Xmax=1;
Ymax=1;
radius=2;
xsd=ones(1,user(t))*Xmax;
ysd=ones(1,user(t))*Ymax;
rrx=radius*sqrt(rand(1,N_UE(t)));
thetarx=2*pi*rand(1,N_UE(t));
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
d1(t) = sqrt((xunit-xsd)^2+(yunit-ysd)^2) ;
d2(t) = sqrt((xunit-xrx)^2+(yunit-yrx)^2) ;
end
  9 commentaires
jaah navi
jaah navi le 8 Fév 2019
Could you please elaborate on cfprintf in the File Exchange
Walter Roberson
Walter Roberson le 8 Fév 2019
https://www.mathworks.com/matlabcentral/fileexchange/24093-cprintf-display-formatted-colored-text-in-the-command-window

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by