├── compare_beamforming ├── config.m ├── cacfar.m ├── gocfar.m ├── scfar.m ├── vicfar.m ├── wbfb.m ├── BigScan.m ├── compare.m ├── compare1.m ├── getdisg.m ├── after2fft.m ├── cfarhandled.m ├── generateRcs.m ├── getresponse.m ├── plotObject.m ├── setConfig.m ├── updatemap.m ├── vicfar_half.m ├── handlePoints.m ├── BeamFindObject.m ├── SmartDetection.m ├── getCircleRandomPoints.m ├── getRandomInitObject.m ├── getBigBeamTrackingWindow.m ├── getSmallBeamScanningWindow.m └── dbscan.m ├── .gitignore ├── SVI-CFAR ├── cacfar.m ├── gocfar.m ├── scfar.m ├── socfar.m ├── svicfar.m ├── vicfar.m ├── simu_svicfar.m ├── sviscfarbianyuan.m ├── sviscfarbianyuan1.m ├── simu_svicfar_multi.m └── getsvichoice.m ├── detection ├── cacfar.m ├── gocfar.m ├── scfar.m ├── vicfar.m ├── wbfb.m ├── getdisg.m ├── after2fft.m ├── cfarhandled.m ├── generateRcs.m ├── getresponse.m ├── plotObject.m ├── setConfig.m ├── updatemap.m ├── vicfar_half.m ├── handlePoints.m ├── BeamFindObject.m ├── radarDetection.m ├── getCircleRandomPoints.m ├── getRandomInitObject.m ├── getBigBeamTrackingWindow.m ├── getSmallBeamScanningWindow.m └── dbscan.m ├── testcfar ├── cacfar.m ├── scfar.m ├── vicfar.m ├── testcfar.m └── vicfar_half.m ├── twodimentrack ├── wbfb.m ├── cacfar.m ├── getdisg.m ├── movemap.m ├── after2fft.m ├── fallstone.m ├── updatemap.m ├── cfarhandled.m ├── getresponse.m └── radarsystem.m ├── trackgenerate ├── mbpara.m ├── trackagrr.m ├── getmultidata.m ├── obmutipoint.m └── dbscan.m ├── README.md └── .gitattributes /compare_beamforming/config.m: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *.asv 3 | *.mat 4 | *.bmp 5 | *.fig -------------------------------------------------------------------------------- /SVI-CFAR/cacfar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/SVI-CFAR/cacfar.m -------------------------------------------------------------------------------- /SVI-CFAR/gocfar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/SVI-CFAR/gocfar.m -------------------------------------------------------------------------------- /SVI-CFAR/scfar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/SVI-CFAR/scfar.m -------------------------------------------------------------------------------- /SVI-CFAR/socfar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/SVI-CFAR/socfar.m -------------------------------------------------------------------------------- /SVI-CFAR/svicfar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/SVI-CFAR/svicfar.m -------------------------------------------------------------------------------- /SVI-CFAR/vicfar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/SVI-CFAR/vicfar.m -------------------------------------------------------------------------------- /detection/cacfar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/cacfar.m -------------------------------------------------------------------------------- /detection/gocfar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/gocfar.m -------------------------------------------------------------------------------- /detection/scfar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/scfar.m -------------------------------------------------------------------------------- /detection/vicfar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/vicfar.m -------------------------------------------------------------------------------- /detection/wbfb.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/wbfb.m -------------------------------------------------------------------------------- /testcfar/cacfar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/testcfar/cacfar.m -------------------------------------------------------------------------------- /testcfar/scfar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/testcfar/scfar.m -------------------------------------------------------------------------------- /testcfar/vicfar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/testcfar/vicfar.m -------------------------------------------------------------------------------- /detection/getdisg.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/getdisg.m -------------------------------------------------------------------------------- /testcfar/testcfar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/testcfar/testcfar.m -------------------------------------------------------------------------------- /twodimentrack/wbfb.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/twodimentrack/wbfb.m -------------------------------------------------------------------------------- /SVI-CFAR/simu_svicfar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/SVI-CFAR/simu_svicfar.m -------------------------------------------------------------------------------- /detection/after2fft.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/after2fft.m -------------------------------------------------------------------------------- /detection/cfarhandled.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/cfarhandled.m -------------------------------------------------------------------------------- /detection/generateRcs.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/generateRcs.m -------------------------------------------------------------------------------- /detection/getresponse.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/getresponse.m -------------------------------------------------------------------------------- /detection/plotObject.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/plotObject.m -------------------------------------------------------------------------------- /detection/setConfig.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/setConfig.m -------------------------------------------------------------------------------- /detection/updatemap.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/updatemap.m -------------------------------------------------------------------------------- /detection/vicfar_half.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/vicfar_half.m -------------------------------------------------------------------------------- /testcfar/vicfar_half.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/testcfar/vicfar_half.m -------------------------------------------------------------------------------- /trackgenerate/mbpara.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/trackgenerate/mbpara.m -------------------------------------------------------------------------------- /twodimentrack/cacfar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/twodimentrack/cacfar.m -------------------------------------------------------------------------------- /twodimentrack/getdisg.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/twodimentrack/getdisg.m -------------------------------------------------------------------------------- /twodimentrack/movemap.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/twodimentrack/movemap.m -------------------------------------------------------------------------------- /detection/handlePoints.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/handlePoints.m -------------------------------------------------------------------------------- /trackgenerate/trackagrr.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/trackgenerate/trackagrr.m -------------------------------------------------------------------------------- /twodimentrack/after2fft.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/twodimentrack/after2fft.m -------------------------------------------------------------------------------- /twodimentrack/fallstone.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/twodimentrack/fallstone.m -------------------------------------------------------------------------------- /twodimentrack/updatemap.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/twodimentrack/updatemap.m -------------------------------------------------------------------------------- /SVI-CFAR/sviscfarbianyuan.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/SVI-CFAR/sviscfarbianyuan.m -------------------------------------------------------------------------------- /SVI-CFAR/sviscfarbianyuan1.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/SVI-CFAR/sviscfarbianyuan1.m -------------------------------------------------------------------------------- /compare_beamforming/cacfar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/cacfar.m -------------------------------------------------------------------------------- /compare_beamforming/gocfar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/gocfar.m -------------------------------------------------------------------------------- /compare_beamforming/scfar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/scfar.m -------------------------------------------------------------------------------- /compare_beamforming/vicfar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/vicfar.m -------------------------------------------------------------------------------- /compare_beamforming/wbfb.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/wbfb.m -------------------------------------------------------------------------------- /detection/BeamFindObject.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/BeamFindObject.m -------------------------------------------------------------------------------- /detection/radarDetection.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/radarDetection.m -------------------------------------------------------------------------------- /trackgenerate/getmultidata.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/trackgenerate/getmultidata.m -------------------------------------------------------------------------------- /trackgenerate/obmutipoint.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/trackgenerate/obmutipoint.m -------------------------------------------------------------------------------- /twodimentrack/cfarhandled.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/twodimentrack/cfarhandled.m -------------------------------------------------------------------------------- /twodimentrack/getresponse.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/twodimentrack/getresponse.m -------------------------------------------------------------------------------- /twodimentrack/radarsystem.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/twodimentrack/radarsystem.m -------------------------------------------------------------------------------- /SVI-CFAR/simu_svicfar_multi.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/SVI-CFAR/simu_svicfar_multi.m -------------------------------------------------------------------------------- /compare_beamforming/BigScan.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/BigScan.m -------------------------------------------------------------------------------- /compare_beamforming/compare.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/compare.m -------------------------------------------------------------------------------- /compare_beamforming/compare1.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/compare1.m -------------------------------------------------------------------------------- /compare_beamforming/getdisg.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/getdisg.m -------------------------------------------------------------------------------- /compare_beamforming/after2fft.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/after2fft.m -------------------------------------------------------------------------------- /compare_beamforming/cfarhandled.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/cfarhandled.m -------------------------------------------------------------------------------- /compare_beamforming/generateRcs.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/generateRcs.m -------------------------------------------------------------------------------- /compare_beamforming/getresponse.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/getresponse.m -------------------------------------------------------------------------------- /compare_beamforming/plotObject.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/plotObject.m -------------------------------------------------------------------------------- /compare_beamforming/setConfig.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/setConfig.m -------------------------------------------------------------------------------- /compare_beamforming/updatemap.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/updatemap.m -------------------------------------------------------------------------------- /compare_beamforming/vicfar_half.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/vicfar_half.m -------------------------------------------------------------------------------- /detection/getCircleRandomPoints.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/getCircleRandomPoints.m -------------------------------------------------------------------------------- /detection/getRandomInitObject.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/getRandomInitObject.m -------------------------------------------------------------------------------- /compare_beamforming/handlePoints.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/handlePoints.m -------------------------------------------------------------------------------- /compare_beamforming/BeamFindObject.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/BeamFindObject.m -------------------------------------------------------------------------------- /compare_beamforming/SmartDetection.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/SmartDetection.m -------------------------------------------------------------------------------- /detection/getBigBeamTrackingWindow.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/getBigBeamTrackingWindow.m -------------------------------------------------------------------------------- /detection/getSmallBeamScanningWindow.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/detection/getSmallBeamScanningWindow.m -------------------------------------------------------------------------------- /compare_beamforming/getCircleRandomPoints.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/getCircleRandomPoints.m -------------------------------------------------------------------------------- /compare_beamforming/getRandomInitObject.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/getRandomInitObject.m -------------------------------------------------------------------------------- /compare_beamforming/getBigBeamTrackingWindow.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/getBigBeamTrackingWindow.m -------------------------------------------------------------------------------- /compare_beamforming/getSmallBeamScanningWindow.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minejo/RadarDetection/HEAD/compare_beamforming/getSmallBeamScanningWindow.m -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | #微波探测项目仿真代码 3 | ##实现功能 4 | * 波束赋形方案仿真 5 | 见compare_beamforming文件夹 6 | * 比较CFAR算法性能 7 | 通过蒙特卡洛方法比较svi-cfar算法优劣(单目标),见SVI-CFAR文件夹 8 | * 整体雷达系统的仿真 9 | 见detection文件夹,先运行setConfig获取参数数据,然后运行radarDetection即可 10 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.p -crlf -diff -merge 2 | *.slx -crlf -diff -merge 3 | *.mdl -crlf -diff -merge 4 | *.mdlp -crlf -diff -merge 5 | *.slxp -crlf -diff -merge 6 | *.sldd -crlf -diff -merge 7 | *.mexa64 -crlf -diff -merge 8 | *.mexw32 -crlf -diff -merge 9 | *.mexw64 -crlf -diff -merge 10 | *.mexmaci64 -crlf -diff -merge 11 | *.xlsx -crlf -diff -merge 12 | *.docx -crlf -diff -merge 13 | *.pdf -crlf -diff -merge 14 | *.jpg -crlf -diff -merge 15 | *.png -crlf -diff -merge 16 | -------------------------------------------------------------------------------- /SVI-CFAR/getsvichoice.m: -------------------------------------------------------------------------------- 1 | function [AB,go,B,A,S] = getsvichoice( choice ) 2 | c1=0; 3 | c2=0; 4 | c3=0; 5 | c4=0; 6 | c5=0; 7 | 8 | for i=1:length(choice) 9 | if(choice(i)==1) 10 | c1=c1+1; 11 | end 12 | if(choice(i)==2) 13 | c2=c2+1; 14 | end 15 | if(choice(i)==3) 16 | c3=c3+1; 17 | end 18 | if(choice(i)==4) 19 | c4=c4+1; 20 | end 21 | if(choice(i)==5) 22 | c5=c5+1; 23 | end 24 | end 25 | 26 | AB=c1/length(choice); 27 | go=c2/length(choice); 28 | B=c3/length(choice); 29 | A=c4/length(choice); 30 | S=c5/length(choice); 31 | end 32 | 33 | -------------------------------------------------------------------------------- /trackgenerate/dbscan.m: -------------------------------------------------------------------------------- 1 | 2 | % ------------------------------------------------------------------------- 3 | % Function: [class,type]=dbscan(x,k,Eps) 4 | % ------------------------------------------------------------------------- 5 | % Aim: 6 | % Clustering the data with Density-Based Scan Algorithm with Noise (DBSCAN) 7 | % ------------------------------------------------------------------------- 8 | % Input: 9 | % x - data set (m,n); m-objects, n-variables 10 | % k - number of objects in a neighborhood of an object 11 | % (minimal number of objects considered as a cluster) 12 | % Eps - neighborhood radius, if not known avoid this parameter or put [] 13 | % ------------------------------------------------------------------------- 14 | % Output: 15 | % class - vector specifying assignment of the i-th object to certain 16 | % cluster (m,1) 17 | % type - vector specifying type of the i-th object 18 | % (core: 1, border: 0, outlier: -1) 19 | % ------------------------------------------------------------------------- 20 | % Example of use: 21 | % x=[randn(30,2)*.4;randn(40,2)*.5+ones(40,1)*[4 4]]; 22 | % [class,type]=dbscan(x,5,[]) 23 | % clusteringfigs('Dbscan',x,[1 2],class,type) 24 | % ------------------------------------------------------------------------- 25 | % References: 26 | % [1] M. Ester, H. Kriegel, J. Sander, X. Xu, A density-based algorithm for 27 | % discovering clusters in large spatial databases with noise, proc. 28 | % 2nd Int. Conf. on Knowledge Discovery and Data Mining, Portland, OR, 1996, 29 | % p. 226, available from: 30 | % www.dbs.informatik.uni-muenchen.de/cgi-bin/papers?query=--CO 31 | % [2] M. Daszykowski, B. Walczak, D. L. Massart, Looking for 32 | % Natural Patterns in Data. Part 1: Density Based Approach, 33 | % Chemom. Intell. Lab. Syst. 56 (2001) 83-92 34 | % ------------------------------------------------------------------------- 35 | % Written by Michal Daszykowski 36 | % Department of Chemometrics, Institute of Chemistry, 37 | % The University of Silesia 38 | % December 2004 39 | % http://www.chemometria.us.edu.pl 40 | 41 | function [class,type]=dbscan(x,k,Eps) 42 | 43 | [m,n]=size(x); 44 | 45 | if nargin<3 || isempty(Eps) 46 | [Eps]=epsilon(x,k); 47 | end 48 | 49 | x=[[1:m]' x]; 50 | [m,n]=size(x); 51 | type=zeros(1,m); 52 | no=1; 53 | touched=zeros(m,1); 54 | 55 | for i=1:m 56 | if touched(i)==0 57 | ob=x(i,:); 58 | D=dist(ob(2:n),x(:,2:n)); 59 | ind=find(D<=Eps); 60 | 61 | if length(ind)>1 && length(ind)=k+1; 72 | type(i)=1; 73 | class(ind)=ones(length(ind),1)*max(no); 74 | 75 | while ~isempty(ind) 76 | ob=x(ind(1),:); 77 | touched(ind(1))=1; 78 | ind(1)=[]; 79 | D=dist(ob(2:n),x(:,2:n)); 80 | i1=find(D<=Eps); 81 | 82 | if length(i1)>1 83 | class(i1)=no; 84 | if length(i1)>=k+1; 85 | type(ob(1))=1; 86 | else 87 | type(ob(1))=0; 88 | end 89 | 90 | for i=1:length(i1) 91 | if touched(i1(i))==0 92 | touched(i1(i))=1; 93 | ind=[ind i1(i)]; 94 | class(i1(i))=no; 95 | end 96 | end 97 | end 98 | end 99 | no=no+1; 100 | end 101 | end 102 | end 103 | 104 | i1=find(class==0); 105 | class(i1)=-1; 106 | type(i1)=-1; 107 | 108 | 109 | %........................................... 110 | function [Eps]=epsilon(x,k) 111 | 112 | % Function: [Eps]=epsilon(x,k) 113 | % 114 | % Aim: 115 | % Analytical way of estimating neighborhood radius for DBSCAN 116 | % 117 | % Input: 118 | % x - data matrix (m,n); m-objects, n-variables 119 | % k - number of objects in a neighborhood of an object 120 | % (minimal number of objects considered as a cluster) 121 | 122 | 123 | 124 | [m,n]=size(x); 125 | 126 | Eps=((prod(max(x)-min(x))*k*gamma(.5*n+1))/(m*sqrt(pi.^n))).^(1/n); 127 | 128 | 129 | %............................................ 130 | function [D]=dist(i,x) 131 | 132 | % function: [D]=dist(i,x) 133 | % 134 | % Aim: 135 | % Calculates the Euclidean distances between the i-th object and all objects in x 136 | % 137 | % Input: 138 | % i - an object (1,n) 139 | % x - data matrix (m,n); m-objects, n-variables 140 | % 141 | % Output: 142 | % D - Euclidean distance (m,1) 143 | 144 | 145 | 146 | [m,n]=size(x); 147 | D=sqrt(sum((((ones(m,1)*i)-x).^2)')); 148 | 149 | if n==1 150 | D=abs((ones(m,1)*i-x))'; 151 | end 152 | -------------------------------------------------------------------------------- /detection/dbscan.m: -------------------------------------------------------------------------------- 1 | 2 | % ------------------------------------------------------------------------- 3 | % Function: [class,type]=dbscan(x,k,Eps) 4 | % ------------------------------------------------------------------------- 5 | % Aim: 6 | % Clustering the data with Density-Based Scan Algorithm with Noise (DBSCAN) 7 | % ------------------------------------------------------------------------- 8 | % Input: 9 | % x - data set (m,n); m-objects, n-variables 10 | % k - number of objects in a neighborhood of an object 11 | % (minimal number of objects considered as a cluster) 12 | % Eps - neighborhood radius, if not known avoid this parameter or put [] 13 | % ------------------------------------------------------------------------- 14 | % Output: 15 | % class - vector specifying assignment of the i-th object to certain 16 | % cluster (m,1) 17 | % type - vector specifying type of the i-th object 18 | % (core: 1, border: 0, outlier: -1) 19 | % ------------------------------------------------------------------------- 20 | % Example of use: 21 | % x=[randn(30,2)*.4;randn(40,2)*.5+ones(40,1)*[4 4]]; 22 | % [class,type]=dbscan(x,5,[]) 23 | % clusteringfigs('Dbscan',x,[1 2],class,type) 24 | % ------------------------------------------------------------------------- 25 | % References: 26 | % [1] M. Ester, H. Kriegel, J. Sander, X. Xu, A density-based algorithm for 27 | % discovering clusters in large spatial databases with noise, proc. 28 | % 2nd Int. Conf. on Knowledge Discovery and Data Mining, Portland, OR, 1996, 29 | % p. 226, available from: 30 | % www.dbs.informatik.uni-muenchen.de/cgi-bin/papers?query=--CO 31 | % [2] M. Daszykowski, B. Walczak, D. L. Massart, Looking for 32 | % Natural Patterns in Data. Part 1: Density Based Approach, 33 | % Chemom. Intell. Lab. Syst. 56 (2001) 83-92 34 | % ------------------------------------------------------------------------- 35 | % Written by Michal Daszykowski 36 | % Department of Chemometrics, Institute of Chemistry, 37 | % The University of Silesia 38 | % December 2004 39 | % http://www.chemometria.us.edu.pl 40 | 41 | function [class,type]=dbscan(x,k,Eps, parameterWeight) 42 | 43 | [m,n]=size(x); 44 | 45 | if nargin<3 || isempty(Eps) 46 | [Eps]=epsilon(x,k); 47 | end 48 | 49 | x=[[1:m]' x]; 50 | [m,n]=size(x); 51 | type=zeros(1,m); 52 | no=1; 53 | touched=zeros(m,1); 54 | 55 | for i=1:m 56 | if touched(i)==0 57 | ob=x(i,:); 58 | D=dist(ob(2:n),x(:,2:n),parameterWeight); 59 | ind=find(D<=Eps); 60 | 61 | if length(ind)>1 && length(ind)=k+1; 72 | type(i)=1; 73 | class(ind)=ones(length(ind),1)*max(no); 74 | 75 | while ~isempty(ind) 76 | ob=x(ind(1),:); 77 | touched(ind(1))=1; 78 | ind(1)=[]; 79 | D=dist(ob(2:n),x(:,2:n),parameterWeight); 80 | i1=find(D<=Eps); 81 | 82 | if length(i1)>1 83 | class(i1)=no; 84 | if length(i1)>=k+1; 85 | type(ob(1))=1; 86 | else 87 | type(ob(1))=0; 88 | end 89 | 90 | for i=1:length(i1) 91 | if touched(i1(i))==0 92 | touched(i1(i))=1; 93 | ind=[ind i1(i)]; 94 | class(i1(i))=no; 95 | end 96 | end 97 | end 98 | end 99 | no=no+1; 100 | end 101 | end 102 | end 103 | 104 | i1=find(class==0); 105 | class(i1)=-1; 106 | type(i1)=-1; 107 | 108 | 109 | %........................................... 110 | function [Eps]=epsilon(x,k) 111 | 112 | % Function: [Eps]=epsilon(x,k) 113 | % 114 | % Aim: 115 | % Analytical way of estimating neighborhood radius for DBSCAN 116 | % 117 | % Input: 118 | % x - data matrix (m,n); m-objects, n-variables 119 | % k - number of objects in a neighborhood of an object 120 | % (minimal number of objects considered as a cluster) 121 | 122 | 123 | 124 | [m,n]=size(x); 125 | 126 | Eps=((prod(max(x)-min(x))*k*gamma(.5*n+1))/(m*sqrt(pi.^n))).^(1/n); 127 | 128 | 129 | %............................................ 130 | function [D]=dist(i,x, parameterWeight) 131 | 132 | % function: [D]=dist(i,x) 133 | % 134 | % Aim: 135 | % Calculates the Euclidean distances between the i-th object and all objects in x 136 | % 137 | % Input: 138 | % i - an object (1,n) 139 | % x - data matrix (m,n); m-objects, n-variables 140 | % 141 | % Output: 142 | % D - Euclidean distance (m,1) 143 | 144 | 145 | 146 | [m,n]=size(x); 147 | D = sqrt((((ones(m,1)*i)-x).^2) * parameterWeight')'; 148 | 149 | if n==1 150 | D=abs((ones(m,1)*i-x)* parameterWeight')'; 151 | end 152 | -------------------------------------------------------------------------------- /compare_beamforming/dbscan.m: -------------------------------------------------------------------------------- 1 | 2 | % ------------------------------------------------------------------------- 3 | % Function: [class,type]=dbscan(x,k,Eps) 4 | % ------------------------------------------------------------------------- 5 | % Aim: 6 | % Clustering the data with Density-Based Scan Algorithm with Noise (DBSCAN) 7 | % ------------------------------------------------------------------------- 8 | % Input: 9 | % x - data set (m,n); m-objects, n-variables 10 | % k - number of objects in a neighborhood of an object 11 | % (minimal number of objects considered as a cluster) 12 | % Eps - neighborhood radius, if not known avoid this parameter or put [] 13 | % ------------------------------------------------------------------------- 14 | % Output: 15 | % class - vector specifying assignment of the i-th object to certain 16 | % cluster (m,1) 17 | % type - vector specifying type of the i-th object 18 | % (core: 1, border: 0, outlier: -1) 19 | % ------------------------------------------------------------------------- 20 | % Example of use: 21 | % x=[randn(30,2)*.4;randn(40,2)*.5+ones(40,1)*[4 4]]; 22 | % [class,type]=dbscan(x,5,[]) 23 | % clusteringfigs('Dbscan',x,[1 2],class,type) 24 | % ------------------------------------------------------------------------- 25 | % References: 26 | % [1] M. Ester, H. Kriegel, J. Sander, X. Xu, A density-based algorithm for 27 | % discovering clusters in large spatial databases with noise, proc. 28 | % 2nd Int. Conf. on Knowledge Discovery and Data Mining, Portland, OR, 1996, 29 | % p. 226, available from: 30 | % www.dbs.informatik.uni-muenchen.de/cgi-bin/papers?query=--CO 31 | % [2] M. Daszykowski, B. Walczak, D. L. Massart, Looking for 32 | % Natural Patterns in Data. Part 1: Density Based Approach, 33 | % Chemom. Intell. Lab. Syst. 56 (2001) 83-92 34 | % ------------------------------------------------------------------------- 35 | % Written by Michal Daszykowski 36 | % Department of Chemometrics, Institute of Chemistry, 37 | % The University of Silesia 38 | % December 2004 39 | % http://www.chemometria.us.edu.pl 40 | 41 | function [class,type]=dbscan(x,k,Eps, parameterWeight) 42 | 43 | [m,n]=size(x); 44 | 45 | if nargin<3 || isempty(Eps) 46 | [Eps]=epsilon(x,k); 47 | end 48 | 49 | x=[[1:m]' x]; 50 | [m,n]=size(x); 51 | type=zeros(1,m); 52 | no=1; 53 | touched=zeros(m,1); 54 | 55 | for i=1:m 56 | if touched(i)==0 57 | ob=x(i,:); 58 | D=dist(ob(2:n),x(:,2:n),parameterWeight); 59 | ind=find(D<=Eps); 60 | 61 | if length(ind)>1 && length(ind)=k+1; 72 | type(i)=1; 73 | class(ind)=ones(length(ind),1)*max(no); 74 | 75 | while ~isempty(ind) 76 | ob=x(ind(1),:); 77 | touched(ind(1))=1; 78 | ind(1)=[]; 79 | D=dist(ob(2:n),x(:,2:n),parameterWeight); 80 | i1=find(D<=Eps); 81 | 82 | if length(i1)>1 83 | class(i1)=no; 84 | if length(i1)>=k+1; 85 | type(ob(1))=1; 86 | else 87 | type(ob(1))=0; 88 | end 89 | 90 | for i=1:length(i1) 91 | if touched(i1(i))==0 92 | touched(i1(i))=1; 93 | ind=[ind i1(i)]; 94 | class(i1(i))=no; 95 | end 96 | end 97 | end 98 | end 99 | no=no+1; 100 | end 101 | end 102 | end 103 | 104 | i1=find(class==0); 105 | class(i1)=-1; 106 | type(i1)=-1; 107 | 108 | 109 | %........................................... 110 | function [Eps]=epsilon(x,k) 111 | 112 | % Function: [Eps]=epsilon(x,k) 113 | % 114 | % Aim: 115 | % Analytical way of estimating neighborhood radius for DBSCAN 116 | % 117 | % Input: 118 | % x - data matrix (m,n); m-objects, n-variables 119 | % k - number of objects in a neighborhood of an object 120 | % (minimal number of objects considered as a cluster) 121 | 122 | 123 | 124 | [m,n]=size(x); 125 | 126 | Eps=((prod(max(x)-min(x))*k*gamma(.5*n+1))/(m*sqrt(pi.^n))).^(1/n); 127 | 128 | 129 | %............................................ 130 | function [D]=dist(i,x, parameterWeight) 131 | 132 | % function: [D]=dist(i,x) 133 | % 134 | % Aim: 135 | % Calculates the Euclidean distances between the i-th object and all objects in x 136 | % 137 | % Input: 138 | % i - an object (1,n) 139 | % x - data matrix (m,n); m-objects, n-variables 140 | % 141 | % Output: 142 | % D - Euclidean distance (m,1) 143 | 144 | 145 | 146 | [m,n]=size(x); 147 | D = sqrt((((ones(m,1)*i)-x).^2) * parameterWeight')'; 148 | 149 | if n==1 150 | D=abs((ones(m,1)*i-x)* parameterWeight')'; 151 | end 152 | --------------------------------------------------------------------------------