root/applications/dual/SIDP/transformace/make_box4.m @ 965

Revision 862, 0.8 kB (checked in by zimamiro, 15 years ago)
Line 
1function [box zero range eigvec]=make_box4(points)
2%OK
3N=size(points,1);
4dim=size(points,2);
5num_of_points=round(N^(1/dim));
6
7meanval=mean(points,1);
8[eigvec,eigval]=eig((points-ones(N,1)*meanval)'*(points-ones(N,1)*meanval));
9range=2*sqrt(diag(eigval)/N);
10
11box=zeros(N,dim);
12pointer=-range;
13step=2*range/(num_of_points-1);
14jump=[1 num_of_points num_of_points^2];
15%plot3(points(:,1), points(:,2), points(:,3),'r.' ); hold on
16for i=1:N
17    for k=1:dim
18        box(i,k)=pointer(k)+step(k)*mod(floor((i-1)/jump(k)),num_of_points);
19    end
20    %plot3(box(:,1), box(:,2), box(:,3),'b.' )
21end 
22
23box=(box)*eigvec'+ones(N,1)*meanval;
24range=ones(dim,1)./(2*range);
25zero=box(1,:);
26%plot3(box(:,1), box(:,2), box(:,3),'b.' );
27plot(box(:,1), box(:,2),'b.' ); hold on
28plot(points(:,1), points(:,2), 'r.' ); hold off
29
30end
Note: See TracBrowser for help on using the browser.