;----------------------------------------------------------------- ; derivate.pro ; ; written by Andreas Reigber ;------------------------------------------------------------------ ; Calculates the derivative of a 1D-array ; ; Usage: ; res = derivate(arr) ;------------------------------------------------------------------ ; This software has been released under the terms of the GNU Public ; license. See http://www.gnu.org/copyleft/gpl.html for details. ;------------------------------------------------------------------ function derivate,array s=size(array) if s(0) ne 1 then begin print,"Array not one-dimensional" return,-1 endif anz = s(1) back = array - shift(array,1) back(0) = interpol(back(1:*),findgen(anz-1)+1,0) return,back end