Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions