diff options
author | Andreas Bogk <andreas@pt141.(none)> | 2009-01-15 17:17:29 +0100 |
---|---|---|
committer | Andreas Bogk <andreas@pt141.(none)> | 2009-01-15 17:17:29 +0100 |
commit | 7ebd609b4f4139f4dac8627ac00678de89ef4575 (patch) | |
tree | 44cc5b2816c8096e6e22781ee4332d840c5658a4 /viterbi_generator/utils/lower_utils/lower_utils | |
parent | 602a3c8aa8a3d9bd4d93deda6ac932404f39584d (diff) |
Viterbi generator by Piotr Krysik.
Diffstat (limited to 'viterbi_generator/utils/lower_utils/lower_utils')
3 files changed, 114 insertions, 0 deletions
diff --git a/viterbi_generator/utils/lower_utils/lower_utils/complex_vect2number.m b/viterbi_generator/utils/lower_utils/lower_utils/complex_vect2number.m new file mode 100644 index 0000000..f0d6d25 --- /dev/null +++ b/viterbi_generator/utils/lower_utils/lower_utils/complex_vect2number.m @@ -0,0 +1,44 @@ +function [ number ] = complex_vect2number(vector) + + ########################################################################### + # Copyright (C) 2008 by Piotr Krysik # + # pkrysik@stud.elka.pw.edu.pl # + # # + # This program is free software; you can redistribute it and/or modify # + # it under the terms of the GNU General Public License as published by # + # the Free Software Foundation; either version 3 of the License, or # + # (at your option) any later version. # + # # + # This program is distributed in the hope that it will be useful, # + # but WITHOUT ANY WARRANTY; without even the implied warranty of # + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # + # GNU General Public License for more details. # + # # + # You should have received a copy of the GNU General Public License # + # along with this program; if not, write to the # + # Free Software Foundation, Inc., # + # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # + ########################################################################### + +% Change complex vector of values: 1,-1 or j,-j +% into a integer number. + + number=0; + [r,Lh] = size(vector); + for l=1:Lh, + position=2**(l-1); + if(vector(l)==1), + number=number+position*(1); + elseif(vector(l)==-1), + number=number+position*(-1); + elseif(vector(l)==-j), + number=number+position*(1); + elseif(vector(l)==j), + number=number+position*(-1); + end + end + if number < 0, + number=floor(number/2); + else + number=ceil(number/2); + end diff --git a/viterbi_generator/utils/lower_utils/lower_utils/generate_previous.m b/viterbi_generator/utils/lower_utils/lower_utils/generate_previous.m new file mode 100644 index 0000000..942c4dc --- /dev/null +++ b/viterbi_generator/utils/lower_utils/lower_utils/generate_previous.m @@ -0,0 +1,35 @@ +function [ PREVIOUS ] = generate_previous(Lh) + + ########################################################################### + # Copyright (C) 2008 by Piotr Krysik # + # pkrysik@stud.elka.pw.edu.pl # + # # + # This program is free software; you can redistribute it and/or modify # + # it under the terms of the GNU General Public License as published by # + # the Free Software Foundation; either version 3 of the License, or # + # (at your option) any later version. # + # # + # This program is distributed in the hope that it will be useful, # + # but WITHOUT ANY WARRANTY; without even the implied warranty of # + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # + # GNU General Public License for more details. # + # # + # You should have received a copy of the GNU General Public License # + # along with this program; if not, write to the # + # Free Software Foundation, Inc., # + # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # + ########################################################################### + +SYMBOLS_NUM = 2**(Lh+1); +n=1; +for i=1:4:SYMBOLS_NUM, + PREVIOUS(i,1) = n+1; + PREVIOUS(i,2) = n+SYMBOLS_NUM/2+1; + PREVIOUS(i+1,1) = n; + PREVIOUS(i+1,2) = n+SYMBOLS_NUM/2; + PREVIOUS(i+2,1) = n+1; + PREVIOUS(i+2,2) = n+SYMBOLS_NUM/2+1; + PREVIOUS(i+3,1) = n; + PREVIOUS(i+3,2) = n+SYMBOLS_NUM/2; + n=n+2; +end diff --git a/viterbi_generator/utils/lower_utils/lower_utils/make_symbols.m b/viterbi_generator/utils/lower_utils/lower_utils/make_symbols.m new file mode 100644 index 0000000..3849fbd --- /dev/null +++ b/viterbi_generator/utils/lower_utils/lower_utils/make_symbols.m @@ -0,0 +1,35 @@ +function [ SYMBOLS ] = make_symbols(Lh) + + ########################################################################### + # Copyright (C) 2008 by Piotr Krysik # + # pkrysik@stud.elka.pw.edu.pl # + # # + # This program is free software; you can redistribute it and/or modify # + # it under the terms of the GNU General Public License as published by # + # the Free Software Foundation; either version 3 of the License, or # + # (at your option) any later version. # + # # + # This program is distributed in the hope that it will be useful, # + # but WITHOUT ANY WARRANTY; without even the implied warranty of # + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # + # GNU General Public License for more details. # + # # + # You should have received a copy of the GNU General Public License # + # along with this program; if not, write to the # + # Free Software Foundation, Inc., # + # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # + ########################################################################### + +BRANCH_NUM=2**(Lh+1); +SYMBOLS=ones(BRANCH_NUM, Lh); + +for column=1:Lh, + for i=1:(2**column), + SYMBOLS(i:(2**(column+1)):BRANCH_NUM,column)=-1; + end + +end + +SYMBOLS(1:2:BRANCH_NUM, 1:2:Lh) = SYMBOLS(1:2:BRANCH_NUM, 1:2:Lh).*(-j); +SYMBOLS(2:2:BRANCH_NUM, 2:2:Lh) = SYMBOLS(2:2:BRANCH_NUM, 2:2:Lh).*(-j); + |