Given the Discrete Fourier Transform of a function, how do I in Matlab compute the time derivative (with smallest magnitude)? For simplicity, let's say at the first point of the window. The example have been using just to check the method is just this: t = 0:0.001:2*pi; x=sin(t); N_w = length(t); X = fft(x).'/N_w; N_w_odd = mod(N_w,2); if ~N_w_odd % if N_w is even. w = [-N_w/2+1:N_w/2].'; %discrete time angular velocity vector. else % if N_w is odd. w = [-(N_w-1)/2:(N_w-1)/2].'; end Xdiff = i*w.*X; xdiff0 = sum(real(Xdiff)); %Derivative at the first point. This does not yield a feasible result. i*w*X isn't even conjugately symmetric. Can anyone see what I am doing wrong here? I assume it's the omega-vector that is computed inaccurately, but I just can't see what's wrong! Any tips would be appreciated!