root/applications/dual/SIDP/SIDPS/motor_sidps/decompose_index.m
@
1327
Revision 1249, 180 bytes (checked in by zimamiro, 14 years ago) |
---|
Line | |
---|---|
1 | function index=decompose_index(k,n_grid,dim) |
2 | index=zeros(1,dim); |
3 | for i=dim:-1:1 |
4 | index(i)=floor((k-1)/n_grid^(i-1)); |
5 | k=k-index(i)*n_grid^(i-1); |
6 | end |
7 | index=index+1; |
8 | end |
Note: See TracBrowser
for help on using the browser.