function u = init_u(delta_x)
  k = 0
  for l=-3:delta_x:3
    k=k+1
    if((l>=0*delta_x) & (l<=9*delta_x))
      u(k) = 1
    else
      u(k) = 0
    end
  end
endfunction

function u = upwind(a,delta_x,delta_t)
  u = init_u(delta_x)
  iter = 20
  for j=1:iter
    tmp(1) = u(1) - delta_t * a * u(1) / delta_x
    for i=2:length(u)
      tmp(i) = u(i) - delta_t * a * (u(i) - u(i-1)) / delta_x
    end
  end
  u = tmp
  plot2d(u)
endfunction

