root/applications/dual/SIDP/bakalarka/SIDPS/matlab/motor/find_in_hyperstate5.m
@
1351
Revision 1351, 422 bytes (checked in by zimamiro, 13 years ago) |
---|
Rev | Line | |
---|---|---|
[1351] | 1 | function index=find_in_hyperstate5(state,hyperstate) |
2 | ||
3 | index=1; | |
4 | len=(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 | ||
8 | for 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 | |
14 | end | |
15 | ||
16 | end |
Note: See TracBrowser
for help on using the browser.