function [x,sol]=upwind(a,b,N,T,M,t)
nu=1.0;
h=(b-a)/(N+1);k=T/M;
la=nu*k/h;
x=zeros(N+2,1);sol=x;
sol=x;
for i=1:N+2
	x(i)=a+(i-1)*h;
end
uold=zeros(N+2,1);
unew=uold;
uold=g(x);
%for i=1:N+2
%	uold(i)=g(x(i));
%end
j=0;
while (j*k<t)
    for i=2:N+2
	unew(i)=(1-la)*uold(i)+la*uold(i-1);
    end
    j=j+1;
   uold=unew;
end
sol=unew;