Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

HOW CAN I SOLVE THIS PROBLEM???​???!!!!!!!​!!!!!!!!!!

1 Ansicht (letzte 30 Tage)
ali hadjer
ali hadjer am 20 Nov. 2015
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
HELLO I WANT TO FULLFIL MY MATRIX bet with just the value of matrix net for which degree==1 or the max(degree)>1 and distance<r (after each iteration i want to eliminate the points that have distance <r by putting the value 100 in it) but it does not work. It gives a result of bet equal to net.
clc;
clear all;
n=10;
x=100;
y=100;
r=25;
net = [1:n;rand([1,n])*x;rand([1,n])*y];
for i = 1:n
for j = 1:n
X1 = net(2,i);
Y1 = net(3,i);
X2 = net(2,j);
Y2 = net(3,j);
xSide = abs(X2-X1);
ySide = abs(Y2-Y1);
d(i,j) = sqrt(xSide^2+ySide^2);% distance euclidienne ENTRE NOEUD
end
end
degree = zeros(n,1);
for i = 1:n
%for j = i+1:n
for j = 1:n
if (d(i,j)<=r )
degree(i)= degree(i)+1;
end
end
end
bet=zeros(2,n)
for i=1:n
for j=1:n
while d~=100
if degree(i)== 1
bet(2,i)=net(2,i);
bet(3,i)=net(3,i);
else
if max(degree(i))>1 && d(i,j)<r
bet(2,i)=net(2,i);
bet(3,i)=net(3,i);
end
end
d(i,:)=100;
d(:,j)=100;
end
end
end
  2 Kommentare
Image Analyst
Image Analyst am 20 Nov. 2015
I'm not sure I understand. degree is a 1-D vector while bet and net are 2-D matrices. Some comments or example input and output matrices would help.
ali hadjer
ali hadjer am 21 Nov. 2015
YES YOU ARE RIGHT. to understand my probleme i will explaine to you: I want to create a nw matrix (bet) from the old matrix (net) but i have a conditions to do that ; so i calculat a distance between all the point of matrix net (d) and a degree of each point(nombre of point whos distance are inferieur to r(r is a range) ; my condition to creat the matrix bet is if the degree is equal to 1 or i take the maximum value of degree max(degree) and put his corespondant point in matrix *bet*and to eliminat all the point that have a distance <r whit this point i change all his distance to 100

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by