Question: Observe the sample Matlab script message_passing.m. This script generates a character string, converts the string to ASCII values, converts the ASCII values into an array
Observe the sample Matlab script message_passing.m. This script generates a character string, converts the string to ASCII values, converts the ASCII values into an array of bits, turns the bits back into ASCII values, and finally converts the ASCII values back into a message string. In part I of the project, create two functions based on the existing code: one to encode the message and one to decode the bits. Modify the message_passing script so that it uses these functions.
function [ bits_tx ] = my_encode( my_message )
function [ message_rx ] = my_decode( bits_rx )
In part II, add a noise component to the signal before determining the received bits. Use the Matlab randn() function to add random noise with Gaussian distribution and parameters 2 and representing the variance and mean, respectively. Start with values = 0.1 and = 0. Explore what happens to your message when you change the values of and .
Question 1: As you change and , what happens to your message? Why?
Question 2: Consider the noise parameters = 0.1 and = 0.5. How can you change the parameter DECISION_LEVEL to improve the performance of this message passing system?
In Part III, you will analyze the bit errors caused by the noise. In this case, you can randomly generate an array of bits rather than using a message. First, setup the code to generate bits_tx, add noise, and determine bits_rx. Next, determine the number of errors by comparing the values of bits_tx and bits_rx. Finally, determine the percentage of bits that are received in error (i.e., the bit error rate or BER).
Question 3: Using your knowledge of the Gaussian distribution, determine the theoretical probability of getting a bit error (i.e., probability that you transmit a 0 and receive a 1 or transmit a 1 and receive a 0).
Question 4: How does the theoretical BER from question 3 compare with what you see in simulation?
math lab code--
----------------------------------------------------------------------------------------------------------------------------------------------------
% Author: MR % Description: Converts the text string, my_message, to a bit string and % then decodes the bit string to regenerate the original message. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear all close all
my_message = 'Test Message...' DECISION_LEVEL = 0.5;
%% Encode Message ascii_vals = dec2bin(my_message); bits_tx = reshape(ascii_vals,[size(ascii_vals,1)*7,1]);
%% Simulated Signal Transmission sig = bin2dec(bits_tx) + 0; % Add Noise Array Here bits_rx = num2str(sig > DECISION_LEVEL);
%% Decode Message ascii_vals_rx = reshape(bits_rx,[size(bits_rx,1)/7,7]); message_rx = char(bin2dec(ascii_vals_rx)')
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
