Simple code below. (Note: this was part of a large project). The value of L is based on your definition of your order, N. With N = 2L-1. Round N is an odd number. The xbar below is based on the signal that you define as the input signal for your developed system. This was implemented in MATLAB.
L = 40; n = -L:L; % index n from [-40,-39,....,-1,0,1,...,39,40]; h = (1 - (-1).^n)./(pi*n); %impulse response of Hilbert Transform h(41) = 0; %Corresponds to the 0/0 term (for 41st term, 0, in n vector above) xhat = conv(h,xbar); %resultant from Hilbert Transform H(w); plot(abs(xhat))
source share