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