Code covered by the BSD License  

Highlights from
Response of a chanel

Response of a chanel

by

 

Attached file is a mtlab code of a channel response having gausian noise

Channal_response.m
%% Response of a channel simulated by e taps filter
close all                        
clear all
 
%------ Input Data --------------
len=10000; %length of input vector X
input=randn(1,len);
input1=[0, 0, input];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fil=[0.9; 0.4; 0.2]; % No of filter taps       

SNR_dB=10; %%SNR in dbs
SNR_W= 10.^(SNR_dB/10);
var=awgn(input1,SNR_W,1);

Yk=conv(input,fil)+var;
%----------------------------------------------------------------------
error=(Yk)-(input1);
sign_vec=sign(error);
sq_error=error.^2;
MSE=sign_vec.*(sq_error)/len;

%%------------------------ Plotting -----------------------------------
%%
 figure(1)
 subplot(2,1,1); 
 plot(input);title('INPUT SIGNAL');   
 subplot(2,1,2); 
 plot(Yk);title('OUTPUT SIGNAL');   
 
figure(2)
plot(1:len+2,MSE);
xlabel('Input');ylabel('Mean Sq Error');
axis([0 len  -10^(-3) 3*10^(-3)]);
 

Contact us