Error using dbscan. Expected X to be nonempty
Afficher commentaires plus anciens
I have written a code that converts phase differences to path differenes. There seems to be an error while using dbscan. How can I fix this error? Thanks for the help
This is my code :
lambda = 34.64; % in cm, considering 866MhZ frequency
pathData_1 = zeros(1,6);
for i=1:5
theta=PhData_1(i+1)-PhData_1(i);
thetaRad=pi*theta/180;
pathData_1(i)=(thetaRad)*lambda/(4*pi);
end
a=pathData_1/2;
c=ones(1,6).*4; % fixed 8cm distance between two antenna positions
b=sqrt(16-a.^2);
syms xp yp
origin = [4 12 0 8 6 4 2 0 8 76];
validpts=double.empty(0,3);
count=0;
for iter=1:6
ap=a(iter);
bp=b(iter);
if isreal(ap)&&isreal(bp)
count=count+1;
validpt=[origin(iter) ap bp];
validpts=[validpts; validpt];
end
end
figure('Name','For tag ID');
for iter=1:count
f_new = @(xp,yp) ((yp-validpts(iter,1))^2/(validpts(iter,2)^2))-((xp)^2/(validpts(iter,3)^2))-1;
hold on;
fimplicit(f_new)
xlim([-150 150]);
ylim([-50 100]);
end
interpts=double.empty(0,2);
for x=-150:0.1:0
for y=0:0.1:180
for i=1:count
for j=1:count
if abs((((y-validpts(i,1))^2/(validpts(i,2)^2))-((x)^2/(validpts(i,3)^2))-1))<0.001
if abs((((y-validpts(j,1))^2/(validpts(j,2)^2))-((x)^2/(validpts(j,3)^2))-1))<0.001
interpts=[interpts; [x y]];
end
end
end
end
end
end
hold on;
idx = dbscan(interpts,3,3);
gscatter(interpts(:,1),interpts(:,2),idx,'kr','*');
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Axis Labels dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
