root/applications/dual/SIDP/Kopie (2) - finalni implementace/make_box_zaloha.m @ 1312

Revision 1113, 0.7 kB (checked in by zimamiro, 14 years ago)
Line 
1function box = make_box3(points)
2eps=10^-3;
3dim=2;
4
5N=size(points,1);
6num_of_points=round(N^(1/dim));
7
8meanval=mean(points,1);
9medianval=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))';
15range=min(2*medianval',meanval');
16%range=max(points)'/2;
17range=min(range,[50; 15]);
18
19box=zeros(N,dim);
20pointer=[eps;eps];
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 
28
29%plot(box(:,1), box(:,2),'b.' ); hold on; plot(meanval(:,1), meanval(:,2), 'g+' );plot(points(:,1), points(:,2), 'r.' ); hold off
30end
Note: See TracBrowser for help on using the browser.