-- Lowpass Digital Filter -- -- Brian Edmonston, 1996 -- briane@qualcomm.com -- -- lp_filter(t,RC,range,nsteps) lowpass -- filters signal(t) using constant RC -- -- Uses time domain convolution over -- nsteps within time span range. -- -- -- Use radians. Very slow. Shows need -- for native powerPC capability. -- -- Selecting RC can be difficult in some cases. -- -- For signals involving square waves, -- using a prime number for nsteps is best Xsteps = 700 Ysteps = 350 Xmin = 0; Xmax=4 Ymin = -5; Ymax = 5 -- ALL SINUSOID EXAMPLE signal(t) = cos(t) + cos(5*t) + cos(50*t) + cos(500*t) -- The example filter removes most of the 50/2pi and 500/2pi frequency -- signals, and produces a good copy of the 1/2pi and 5/2pi frequency -- signals delayed by some small amount lp_filter(t,RC,range,nsteps) = start := t-range, INC := range/nsteps, total:=sum(signal(start+i*INC)*exp(-RC*(t-(start+i*INC))),i,1,nsteps), total/nsteps lp_filter_1(t,RC,range,nsteps) = start := t-range, INC := range/nsteps, total:=sum(signal_1(start+i*INC)*exp(-RC*(t-(start+i*INC))),i,1,nsteps), total/nsteps plot signal(X) plot cos(X) + cos(5*X) plot lp_filter(X,1,.33,25) -- DIGITAL TRANSMISSION -- Data to be transmitted DATA := { 1,-1, 1,-1,-1}: -- BSPK modulated transmit signal T(t) = DATA[trunc(t+1)]*sin(100*t) -- Non-coherent mixing with carrier -- signal at receive system signal_1(t) = T(t)*sin(100*t + .1*2*pi) -- Plot receive signal and filtered -- and amplified receive signal newaxis plot signal_1(X) plot 5*lp_filter_1(X,10,.05,31)