function df=fder1d(f,dx,nop)
% fDER1D(f,dx,nop) finite difference
% second derivative

nx=max(size(f));

n2=(nop-1)/2;

if nop==3; d=[1 -2 1]/dx^2; end
if nop==5; d=[-1/12 4/3 -5/2 4/3 -1/12]/dx^2; end

df=[1:nx]*0;

for i=1:nop;
df=df+d(i).*cshift1d(f,-n2+(i-1));
end
end
