%%% Matlab exploration for Pulses with Interfering Sinusoid p=[ones(1,9) zeros(1,6)]; %%% Create one pulse and zeros p=[p p p p p]; %%% stack 5 of them together p=0.25*p; %%% adjust its amplitude to be 0.25 subplot(3,1,1) stem(0:74,p) %%% look at the sequence of pulses xlabel('Sample Index, n') ylabel('Pulsed Signal p[n]') x=p+cos((pi/2)*(0:74)); % add in an interfering sinusoid subplot(3,1,2) stem(0:74,x) xlabel('Sample Index, n') ylabel('x[n] Input = pulse + sinusoid') h = ones(1,4); %%% define impulse response of filter y=conv(x,h); %% filter out sinusoid with DT conv subplot(3,1,3) stem(0:77,y) xlabel('Sample Index, n') ylabel('y[n] = Output') %%% Note that pulses are free of sinusoidal interference but have been "smoothed" w=-pi:0.001:pi; H=freqz(h,1,w); figure subplot(2,1,1) plot(w/pi,abs(H)) xlabel('\Omega/\pi (normalized radians/sample)') ylabel('|H(\Omega)|') subplot(2,1,2) plot(w/pi,angle(H)) xlabel('\Omega/\pi (normalized radians/sample)') ylabel('