Question: clear all; close all; file = fopen ( ' TransmittedMessage . txt ' ) ; % Open the file ( should be in the same

clear all;
close all;
file = fopen('TransmittedMessage.txt'); % Open the file (should be in the same folder)
message = fread(file,'*char')'; % Read the text (as a string) from the file
fclose(file); % Close the file
%%%%%%%%%% Converting the message into a bit stream %%%%%%%%%%%%%%%%
text2double_temp = dec2bin(message,8)-'0'; % Convert each character into binary (minus zero is used to convert it into double instead of logical)
% Each character is represented by 8 bits
bit_stream = reshape(text2double_temp.',1,[]); % Reshape it into an array (.' is needed for proper ordering)
%%%%%%%%%%%%%%%%% BPSK Modulation %%%%%%%%%%%%%%%%%%%%%
Fs =25000; % Sampling freq
Tb =1e-3; % Bit duration
fc =10000; % Carrier freq
Eb =1; % Energy per bit
dt =1/Fs; % time step
N = length(bit_stream); % Number of bits to be transmitted
t =0:dt:N*Tb; % Time vector
t = t(1:length(t)-1); % the last element is discarded to adjust the size of the time vector
Stream = repelem(bit_stream,Tb/dt); % Enlarge the bit stream to match the size of the time vector
Stream(Stream==1)=-1; % Replacing 1's with -1(NRZ Level Encoder). This arrangement fits the definition of log likelihood ratio
Stream(Stream==0)=1; % Replacing 0's with 1(NRZ Level Encoder). This arrangement fits the definition of log likelihood ratio
ModulatedSignal = sqrt((2*Eb)/Tb).*cos(2*pi*fc*t).*Stream; % BPSK modulated signal to be transmitted

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!