Matlab code needed!!

Thread Starter


Joined Jan 9, 2007
I need matlab code for the program.program will take binary coded signal like [0 1 1 0] then convert this signal to digital signal by encoder.after signal is modulated the program adds noise to the signal.Signal+noise is demodulated then converted to binary coded signal by decoder.The program should adjust the noise level.At the end, the program should compare the input binary code and output binary code for any errors.But I can't write the code in Matlab.I don't have enough knowledge.Can you help me?:rolleyes:

Or just takes the binary coded signal,puts noise then filters it.The output is the detected signal which is a binary signal too.For low noise levels the input and output signals are same.But at high noise, error will occur in detected signal.The program should compare the output and input signals..
Thanks for your concern have a nice day...:) :)


Joined Nov 16, 2006
Hey Zico
I have done something very similar. I can't remember what modulation it was i think it was CDMA. Anyway that doesn't matter. The key thing is i create a string of bits (variable lenght if i remember) , matlab has built in functions, its very easy. I modulate it and then use a built in function called awgn() to add the noise (additive white gaussian noise). Thats all in the transmitter section. The receiver then demodulates it and compares the input string to the received string and again if i remember properly graphs the BER.
I can send you the code if you post your email? I'd have to dig it out, but if i find it i have alot other information and links that might help.



Joined Nov 16, 2006
Hey Zico
I will send you the information shortly, unfortunately iam at work and all the files are on my computer at home, it will be about 6hrs before i get home and i will send it straight away. Sorry for the delay!!



Joined Mar 24, 2008
Hey, i hope anyone of you people still have the code, i need something similar to what zico posted so if there is anyway i can get the code on matlab can yo usend it to my email,, thanks in advance


Joined Apr 18, 2010
see this code:

clear all;
close all;
%% Data Generation

nb=1000; % Number of bits


%% Setting Parameters

ts=1/100; % Sampling Time

t=0: ts : ( nb - 1) * ts; % Time Vector

V=1; % +- V
%% algorithm

subplot(3,1,1);stairs(t(1:20),data(1:20));title('Line Codes')
ylim([-1 2]);xlabel('t');ylabel('DATA');grid on
subplot(3,1,2);stairs(t(1:20),p_nrz(1:20));ylim([-V-1 V+1]) ;
xlabel('t');ylabel('POLAR NRZ-L');grid on
%% Decoding
subplot(3,1,3);stairs(t(1:20),dcdata(1:20));ylim([-V-1 V+1]) ;
xlabel('t');ylabel('ORIGINAL DATA');grid on