0
\$\begingroup\$

I have a wireless channel, for which I need to pass binary bits and input and measure the BER at the output.

The problem for me here is varying the data rate at the input.

How can I represent the signal data rate at the input ? I would like to measure the data rate for say 1bps, 10bps,100bps. But I am not sure how to do that.

All I need is help in representing or making or pushing the data bits into the channel interms of bit rate.

Here is the code that I am trying:

N=10000; % Number of bits , size of transmitted signal x_inp=[x_1 x_2 ... x_N] 
x_inp= rand(1,N)<0.5;  % binary signal 0 or 1 % message to be transmitted                               
Tb=0.0001; % bit period (second)   


% ********************* Represent input signal as digital signal ****
x_bit=[]; 
nb=N; % bbit/bit
for n=1:1:N   % 
    if x_inp(n)==1;  % 
       x_bitt=ones(1,nb);
    else x_inp(n)==0;
        x_bitt=zeros(1,nb);
    end
     x_bit=[x_bit x_bitt];
end

t1=Tb/nb:Tb/nb:nb*N*(Tb/nb); % time of the signal 
f1 = figure(1);
set(f1,'color',[1 1 1]);
subplot(3,1,1);
plot(t1,x_bit,'lineWidth',2);grid on;
axis([ 0 Tb*N -0.5 1.5]);
ylabel('Tmplitude(volt)');
xlabel(' Time(sec)');
title('Input signal as digital signal');



% ********************* Define BFSK Modulation ****************************
Ac=5;  % Amplitude of carrier signal
fc1= 1.5*10^6; % carrier frequency for bit 1
fc2= 2.5*10^6; % carrier frequency for bit 0
t2=Tb/nb:Tb/nb:Tb;                 
t2L=length(t2);
x_mod=[];
for (i=1:1:N)
    if (x_inp(i)==1)
        x_mod0=Ac*cos(2*pi*fc1*t2);%modulation signal with carrier signal 1
    else
        x_mod0=Ac*cos(2*pi*fc2*t2);%modulation signal with carrier signal 2
    end
    x_mod=[x_mod x_mod0];
end
t3=Tb/nb:Tb/nb:Tb*N;
subplot(3,1,2);
plot(t3,x_mod);
xlabel('Time(sec)');
ylabel('Amplitude(volt)');
title('Signal of  BASK modulation ');

% ********************* Transmitted signal x ******************************
x=x_mod;

Next this signal will be fed into the channel but I want to pass have a control over the data rate or the bit rate. Any suggestions ?

\$\endgroup\$
0
\$\begingroup\$

It looks like Tb is meant to represent the period of a bit (i.e., 1 over the bit rate), but the rest of your code is very confused about the distinction between "bits of data" and "samples of signal".

For example, N seems to be the total number of bits, but you set nb = N, where nb appears to represent the number of samples per bit — this makes no sense.

The system sample rate should be an independent parameter, and the samples/bit value should be the ratio of the sample rate and the bit rate. The calculation of the modulated waveforms should only depend on the system sample rate.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.