function [N_hat,dN_hat,connect_l,spv_hat] = loworder_Bsp(ini_Val,lower)
%function to calculate lowerorder B-spline
%
if nargin==1
    lower=1;
end

p = ini_Val.p-lower;
gaussno = ini_Val.gaussno;
U = ini_Val.U;
a = U';
aa =  U';
U(1:lower)= [];
U(end-lower+1:end)=[];
a(1:p+lower)=[];
a(end-p-lower+1:end)=[];
aa(1:p+lower)=[];
aa(end-p-lower+1:end)=[];
b=a;
a(length(a)) = [];
b(1) = [];
[gpoint,gweight_local]=gaquad(gaussno);
h = ((b-a)/2);
%
N_hat = zeros(length(a)*gaussno,(p+1));
dN_hat = zeros(length(a)*gaussno,(p+1));
iglobal=0;
connect_l = [];
for i=1:length(a)
    for k=1:gaussno
        iglobal=iglobal+1;
        gweight(iglobal)=gweight_local(k)*h(i);
        gaussp =((b(i)-a(i))/2)*gpoint(k)+((a(i)+b(i))/2);
        [Nsh,sp]=evaluate_BSp(U,p,1,gaussp);
        %[Nsh,sp]=Bsp(U,p,gaussp);
        %N_hat(iglobal,:)=Nsh;
        N_hat(iglobal,:)=Nsh(1,:);
        dN_hat(iglobal,:)=Nsh(2,:);
        h_l(iglobal)=aa(sp-p+1)-aa(sp-p);
        spv_hat(iglobal)=sp-p;
    end
    connect_l(i,:)=[i:i+p];
end

        
        