Revision 1113, 0.7 kB
(checked in by zimamiro, 14 years ago)
|
|
Line | |
---|
1 | function box = make_box3(points)
|
---|
2 | eps=10^-3;
|
---|
3 | dim=2;
|
---|
4 |
|
---|
5 | N=size(points,1);
|
---|
6 | num_of_points=round(N^(1/dim));
|
---|
7 |
|
---|
8 | meanval=mean(points,1);
|
---|
9 | medianval=median(points,1);
|
---|
10 |
|
---|
11 | %range=1.5*sqrt(diag(eigval)/N);
|
---|
12 | %pom=points*eigvec/2;
|
---|
13 | %range=min((max(pom)-min(pom))',range);
|
---|
14 | %range=(max(points)-min(points))';
|
---|
15 | range=min(2*medianval',meanval');
|
---|
16 | %range=max(points)'/2;
|
---|
17 | range=min(range,[50; 15]);
|
---|
18 |
|
---|
19 | box=zeros(N,dim);
|
---|
20 | pointer=[eps;eps];
|
---|
21 | step=2*range/(num_of_points-1);
|
---|
22 | jump=[1 num_of_points ];
|
---|
23 | for i=1:N
|
---|
24 | for k=1:dim
|
---|
25 | box(i,k)=pointer(k)+step(k)*mod(floor((i-1)/jump(k)),num_of_points);
|
---|
26 | end
|
---|
27 | end
|
---|
28 |
|
---|
29 | %plot(box(:,1), box(:,2),'b.' ); hold on; plot(meanval(:,1), meanval(:,2), 'g+' );plot(points(:,1), points(:,2), 'r.' ); hold off
|
---|
30 | end |
---|