root/applications/dual/SIDP/transformace/make_box3.m @ 958

Revision 862, 1.0 kB (checked in by zimamiro, 15 years ago)
Line 
1function [box zero range eigvec]=make_box3(points)
2eps=10^-2;
3%OK
4
5N=size(points,1);
6dim=size(points,2);
7num_of_points=round(N^(1/dim));
8
9meanval=min(mean(points,1),1-2*eps);
10medianval=2*(median(abs(points-ones(N,1)*meanval),1));
11eigvec=eye(dim);
12
13%range=1.5*sqrt(diag(eigval)/N);
14%pom=points*eigvec/2;
15%range=min((max(pom)-min(pom))',range);
16%range=(max(points)-min(points))';
17range=min(medianval',min(1-eps-meanval',meanval'-eps));
18
19box=zeros(N,dim);
20pointer=-range;
21step=2*range/(num_of_points-1);
22jump=[1 num_of_points ];
23for 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
27end 
28box=box+ones(N,1)*(meanval.*[1 1]);
29range=ones(dim,1)./(2*range);
30if box(1,1)==0
31    box=box+ones(N,1)*(eps*[1 0]);
32end
33if box(1,2)==0
34    box=box+ones(N,1)*(eps*[0 1]);
35end
36zero=box(1,:);
37
38%plot(box(:,1), box(:,2),'b.' ); hold on; plot(meanval(:,1), meanval(:,2), 'g+' );plot(points(:,1), points(:,2), 'r.' ); hold off
39end
Note: See TracBrowser for help on using the browser.