function L25_gaussian_filter % %NRZeye2: script to produce eye diagrams for NRZ data % % copyright 2001 Eric Swanson % %100 random NRZ bits sampled 1000 times per bit period % xr=rand(100,1); x=ones(100000,1); for m2=1:100; if xr(m2,1)<0.5 xr(m2,1)=-1; end; if xr(m2,1)>=0.5 xr(m2,1)=+1; end; for m1=1:1000; m=1000*(m2-1)+m1; x(m,1)=xr(m2,1); end; end; % %perform 100000 point DFT % xf=fft(x); % %compute filter coefficients for a Gaussian filter at fs=300GHz % 10-90% risetime is trise % hoft=ones(100000,1); trise=100e-12; fs=3e11; sigma=trise*fs/2/1.28; index=[-5000:5000]'; hoft(1:10001)=exp(-(index.^2)/2/sigma^2); hoft(10002:100000)=0; % %adjust dc gain of the Gaussian to 1.0 % hoft=hoft/sum(hoft); % %perform 100000 point DFT % hf=fft(hoft); % %compute the cable response at each bin of the 100000 point 300GHz DFT % k=1.023e-6; L=150; hcf(1,1)=1; hcf(50001,1)=0; for m1=2:50000; hcf(m1,1)=exp(-k*L*sqrt(3e11/1e5*(m1-1)))*exp(-i*k*L*sqrt(3e11/1e5*(m1-1))); hcf(100000-m1+2,1)=conj(hcf(m1,1)); end; % %filter the ideal NRZ data spectrum via transform multiplication % totalf=xf.*hf.*hcf; % %perform inverse DFT % x1=ifft(totalf); % %generate eye diagram % time=[0:10/3000:10-10/3000]'; offset=450; figure (1); hold off; for m1=2:97; m=1000*(m1-1)+offset; plot(time,x1(m:m+2999),'-w'); hold on; end; bottom=-1.6*ones(11,1); top=1.6*ones(11,1); time1=[0:10]'; plot(time1(1:11),bottom(1:11),'-b',time1(1:11),top(1:11),'-b'); hold off; axis([0 10 -1.65 1.65]); axis off;