pro differentiator2

twopi=2*!pi

n=100 & nm=n-1 ;n = points in sample, even integer.

& nh=n/2 ;half of points in sample, integer.

x=findgen(n) ;real variable space. Period is 100 times the interval of sampling.

;fundamental frequency is 1/100. Fundamental angular frequency is 2 pi / 100.

;sampling frequency is 1. sampling angular frequency is 2 pi.

signal= fltarr (n) ;measured signal

for j=0,nm do begin

signal (j)= 10.*abs(nh-j)/nh ;a "V", changes at 0.2/point

endfor

signal(3*n/4)=0

plot,signal &wait,2

differ=fltarr(n) ;the differential operator

differ(nm)=0.5

differ(1)=-0.5

;fourier transforms

fsignal=fft(signal,/double) ;a n- term, double precision, complex array.

fdiffer=fft(differ,/double) ;the transform of the differentiator

fder=fsignal*fdiffer

dersignal=n*fft(fder,1,/double)

plot,x,dersignal

stop

end