function y=haarval(c,x)
  n=min(size(c))-1;

  for k=1:length(x)
    y(k)=0;
    for i=1:n+1
      for j=1:2^(i-1)
	y(k)=y(k)+c(i,j)*mf(2^(i-1)*x(k)-j+1);
      endfor;
    endfor;
  endfor;
endfunction