Monday 15 April 2013

matlab - How to determine the index of a vector with range from 1 -



matlab - How to determine the index of a vector with range from 1 -

i have question way determine index of vector in matlab. allow see problem figure. have 6 bits includes 2 parts: reddish part , bluish part. size of reddish part |s1| , bluish part |s2|(ex: |s1|=2 , |s2|=4). index of original bits (6 bits) 0 l . now, dumplicate reddish part twice time , bluish part 1 time create below bit index 0 j. size of reddish part rf1*|s1| , bluish part rf2*|s2|. (ex: rf1=2 , rf2=1). given index in below bits (from 0 j), can determine index l of them in original bit formula in figure.

for example, if index of selected info symbol is, example, 5, map 5 mod 4+2=3 (red arrow) however, index of problem 0. know, index of vector in matlab starts 1. changes below figure. problem how find index l if given index j matlab code using sec scheme (index 1). done looks complex

for index starts 1, can see want map index j=6 l=4 table illustration

this code

function l=find_index(j,s1,s2,rf1,rf2) if j<(rf1*s1-1) l=mod(j,s1); if l==0 l=s1; end else l=mod(j,rf2*s2)+s1 ; if l==0 l=s2; end end end

maybe this?

function l=find_index(j,s1,s2,rf1,rf2) if j<=(rf1*s1) l=mod(j-1,s1)+1; else l=mod(j-rf1*s1-1,s2)+s1+1; end end

matlab

No comments:

Post a Comment