putmoveatpos.m
来自「UMDA. a kind of estimation of distributi」· M 代码 · 共 45 行
M
45 行
function[Pos] = PutMoveAtPos(Pos,pos,mov)% PutMoveAtPos updates the lattice given a mov% INPUTS% sizeChain: Size of the subchain inspected% pos: Position of the residue in the sequence % mov: Corresponding move (left,front,right)% OUTPUTS% Pos: Final configuration of the sequence if (pos<3) return;endi = pos; if(Pos(i-1,2)==Pos(i-2,2)) if (mov==0) %UP MOVE Pos(i,1) = Pos(i-1,1); Pos(i,2) = Pos(i-1,2) + (Pos(i-1,1)-Pos(i-2,1)); elseif (mov==1) %FORWARD MOVE Pos(i,1) = Pos(i-1,1) + (Pos(i-1,1)-Pos(i-2,1)); Pos(i,2) = Pos(i-1,2); else %DOWN MOVE Pos(i,1) = Pos(i-1,1); Pos(i,2) = Pos(i-1,2) - (Pos(i-1,1)-Pos(i-2,1)); end endif (Pos(i-1,1)==Pos(i-2,1)) if (mov==0) %UP MOVE Pos(i,2) = Pos(i-1,2); Pos(i,1) = Pos(i-1,1) - (Pos(i-1,2)-Pos(i-2,2)); elseif (mov==1) %FORWARD MOVE Pos(i,2) = Pos(i-1,2) + (Pos(i-1,2)-Pos(i-2,2)); Pos(i,1) = Pos(i-1,1); else %DOWN MOVE Pos(i,2) = Pos(i-1,2); Pos(i,1) = Pos(i-1,1) + (Pos(i-1,2)-Pos(i-2,2)); end end% Last version 10/09/2005. Roberto Santana (rsantana@si.ehu.es)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?