function D= basisp_function (J , X , T)  

N= length(X);

    Dvalue=0;
         if (J==1) 
           if (T < X(2)); 
               Dvalue = (-1)/(X(2)-X(1)); 
           end
         elseif (1<J<N)
             if X(J-1)<T & T <=X(J)
                 Dvalue=1 /(X(J)-X(J-1));
             elseif (X(J) <=T & T < X(J+1))
                 Dvalue=-1 /(X(J+1)-X(J));
             end
         elseif (J==N)
             if (X(N-1)< T & T <= X(N))
                 Dvalue= 1 /(X(N)-X(N-1));
             end
         end 
   D= Dvalue; 
end