root/applications/dual/SIDP/Kopie (2) - finalni implementace/find_in_hyperstate5.m @ 1183

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