clear; % Maximum length of Signal vector N=65536*8 %N=65536*8/16 % shortened version % cut off of butterworth filter representing the channel response fc=N/8; % order of the butterworth filter representing the channel response Norder=8; % the rest of the code demonstrates how the channel will be implemented. % formulate project for ee511 2002 Nbits=65536/4; %Nbits=65536/(2*4); % shortened version Nsample=N/Nbits % filter parameter; fmax=N/2; % create random vector s=rand(1,Nbits); sb=binarize(s); u=ones(1,Nsample); b=kron(sb,u); % add noise noise=0.05*randn(1,N); b=b+noise; B=fft(b); n=1:N; % create filter K=1; % filter gain [f H]=lp_butterworth_oN_dft(fc,K,fmax,N,Norder); % convolve signal with filter R=B.*H; r=real(ifft(R)); % plot input and output (first 16 bits) figure(1); if Nbits>=16 bplot=b(1:Nsample*16); rplot=r(1:Nsample*16); else rplot=r; bplot=b; end; a=size(bplot); n2=1:a(2); plot(n2,bplot,n2,rplot); %plot(n2,rplot); % plot spectrum of input and spectrum of output figure(2); B(1)=0+i*0; % suppress dc for graphical clarity R(1)=B(1); % suppress dc for graphical clarity plot(n,abs(B)/max(abs(B)),n,abs(R)/max(abs(R)),n,abs(H));