Code covered by the BSD License  

Highlights from
Logiciels temps réel

Logiciels temps réel

by

 

Real-time software concerning the domains of the signal processing, feedback and regulation

sbpa_2.m
function u=sbpa_2(n,s)

if (n<3)|(n>17)
	error('n doit tre compris entre 3 et 17 !')
end;
coeff=ones(20,4);
coeff(3,:)=[1 1 2 3];
coeff(4,:)=[1 1 3 4]; 
coeff(5,:)=[1 1 3 5];
coeff(6,:)=[1 1 5 6];
coeff(7,:)=[1 1 6 7];
coeff(8,:)=[4 5 6 8];
coeff(9,:)=[1 1 5 9];
coeff(10,:)=[1 1 7 10];
coeff(11,:)=[1 1 9 11];
coeff(12,:)=[1 4 6 12];
coeff(13,:)=[1 3 4 13];
coeff(14,:)=[1 3 5 14];
coeff(15,:)=[1 1 14 15];
coeff(16,:)=[4 13 15 16];
coeff(17,:)=[1 1 14 17];
%coeff(18,:)=[1 1 11 18];
%coeff(19,:)=[1 2 6 19];
%coeff(20,:)=[1 1 17 20];
%coeff(21,:)=[1 1 19 21];
%coeff(22,:)=[1 1 21 22];
%coeff(23,:)=[1 1 18 23];
%coeff(24,:)=[17 22 23 24];
%coeff(25,:)=[1 1 22 25];
%coeff(26,:)=[1 2 6 26];
%coeff(27,:)=[1 2 5 27];
%coeff(28,:)=[1 1 25 28];
%coeff(29,:)=[1 1 27 29];
%coeff(30,:)=[1 4 6 30];
%coeff(31,:)=[1 1 28 31];
%coeff(32,:)=[1 2 22 32];     
N=2^n-1;
%u=(-1).^(1:n);
u=ones(1,N);
q=ones(1,n);
c=coeff(n,:);
for k=1:1:N
    q1=-q(c(1))*q(c(2))*q(c(3))*q(c(4));
	q=[q1,q(1:n-1)];
    u(k)=q(n);
end;
u=(u>0)-0.5;
if (nargin==2) & (s=='c')
    u=u-mean(u);
end;

Contact us