root/applications/dual/SIDP/jednoduchy system/find_in_hyperstate5.m @ 1091

Revision 862, 404 bytes (checked in by zimamiro, 15 years ago)
Line 
1function index=find_in_hyperstate5(state,hyperstate)
2
3index=1;
4len=(state(1,1,1)-hyperstate(1,1,1))^2+(state(1,2)-hyperstate(1,1,2))^2+(state(1,1,3)-hyperstate(1,1,3))^2;
5
6for i=2:size(hyperstate,2)
7    pom2=(state(1,1,1)-hyperstate(1,i,1))^2+(state(1,1,2)-hyperstate(1,i,2))^2+(state(1,1,3)-hyperstate(1,i,3))^2;   
8    if pom2<len
9        len=pom2;
10        index=i;
11    end
12end
13   
14end
Note: See TracBrowser for help on using the browser.