Función resta boll

Solo disponible en BuenasTareas
  • Páginas : 3 (613 palabras )
  • Descarga(s) : 0
  • Publicado : 16 de junio de 2011
Leer documento completo
Vista previa del texto
function y = mls(n,flag)

%y = mls(n,{flag});
%
%Generates a Maximum Length Sequence of n bits by utilizing a
%linear feedback shift register with an XOR gate on the tap bits
%
%Functioncan accept bit lengths of between 2 and 24
%
%y is a vector of 1's & -1's that is (2^n)-1 in length.
%
%optional flag is:
%
% 1 for an initial sequence of all ones (repeatable)
% 0 for aninitial sequence that is random (default)
%
%note: Because of the recursive nature of this process, it is not
%possible to completely vectorize this code (at least I don't know
%how to do it). As aresult, longer bit lengths will take quite a
%long time to process, perhaps hours. If you figure out a way to
%vectorize the for loop, please let me know.
%
%reference:
% Davies, W.D.T. (June,July, August, 1966). Generation and
%properties of maximum-length sequences. Control, 302-4, 364-5,431-3.
%
%Spring 2001, Christopher Brown, cbrown@phi.luc.edu

switch n %assign taps whichwill yeild a maximum
case 2 %length sequence for a given bit length
taps=2; %I forget the reference I used, but theres
tap1=1; %a list of appropriate tap values intap2=2; %Vanderkooy, JAES, 42(4), 1994.
case 3
taps=2;
tap1=1;
tap2=3;
case 4
taps=2;
tap1=1;
tap2=4;
case 5
taps=2;
tap1=2;
tap2=5;
case 6
taps=2;tap1=1;
tap2=6;
case 7
taps=2;
tap1=1;
tap2=7;
case 8
taps=4;
tap1=2;
tap2=3;
tap3=4;
tap4=8;
case 9
taps=2;
tap1=4;
tap2=9;
case 10
taps=2;tap1=3;
tap2=10;
case 11
taps=2;
tap1=2;
tap2=11;
case 12
taps=4;
tap1=1;
tap2=4;
tap3=6;
tap4=12;
case 13
taps=4;
tap1=1;
tap2=3;
tap3=4;tap4=13;
case 14
taps=4;
tap1=1;
tap2=3;
tap3=5;
tap4=14;
case 15
taps=2;
tap1=1;
tap2=15;
case 16
taps=4;
tap1=2;
tap2=3;
tap3=5;
tap4=16;
case...
tracking img