[Index for tmp_for_tar/misc] [Return to Master Index]

test_winb

(tmp_for_tar/misc/test_winb.m)


Help text


 Check that winb() functions correctly

 Last modified: April 2001



Listing of file tmp_for_tar/misc/test_winb.m

##
## Check that winb() functions correctly

## Author:        Etienne Grossmann  <etienne@isr.ist.utl.pt>
## Last modified: April 2001

1 ; 

x = -100:7:50 ;
b = 10 ;
y = winb(x,b,"mat") ;

sgnx = -any(y'<0)*2+1  ;
xx = sgnx.*sum(abs(y').*((b.^[size(y,2)-1:-1:0])'*ones(1,size(y,1)))) ; 

cnt = 1 ;
if any( x != xx ),
  printf("not ok %i\n",cnt) ;
else
  printf("ok %i\n",cnt) ;
end
cnt++ ;

sx = toascii(split(sprintf("%i\n",x),"\n")); sx = sx(1:size(sx,1)-1,:) ;
sy = toascii(winb(x,10));
if any(size(sx)!=size(sy)) || any(sx(:)!=sy(:)),  
  printf("not ok %i\n",cnt) ;
else
  printf("ok %i\n",cnt) ;
end
cnt++ ;

Produced by oct2html on Sat Apr 28 21:14:54 2001
Cross-Directory links are: ON