DEPARTMENT OF ELECTRONIC AND COMPUTER ENGINEERING ELEC1200 Final Project Due Date: 10 PM on 9 December 2020 (Wednesday) Notes No late submission will be accepted (ZERO marks!) This project accounts for 30% of your overall grade. Objectives Answer all the questions in part I and determine the data and MAC addresses which were sent in part II. • Part I: answer short questions. • Part II: determine the data and MAC addresses at the receiver. • Submit your runnable MATLAB code. Warning: All submit code will be processing for a similarity check. Those with high similarities will receive zero marks and other possible sanctions. This project is divided into two parts. Part I: 5 Short questions (15%) Part II: Data and addresses at the receiver (15%) ______________________________________________________________________________ Part I: Short questions (3 points each) Submission (online) 1. Place your answers in any word document, save it as a pdf file as ‘Project.pdf’. 2. Submit your runnable MATLAB code in a zip file. The zip file should be labeled as PartI.zip. Instructions: Download ‘PartI.zip’ from the canvas assignment page. Unzip it. Open MATLAB and select the 'PartI' folder and you can find the Q1.m – Q4.m and other files in the 'Current Folder'. Question 1: Consider the transmission of a random bit sequence over an LTI channel with known step response. You need to predict the output of the channel given the input bit sequence, step response and the number of samples used to transmit each bit. On a first attempt the actual response and the prediction, using the code Q1.m, do not match as shown below. Note: the figure may be different. You need to modify the code in Q1.m so that y contains the correct prediction. Do not change the values of bs and SPB in your code. % Modify the code below to predict the channel response y = y + step_response_final(n)-step_response_final(n-SPB); %%%%%%%%%%%%%%%%%%%%%%%%%%%%% Q1: Place your figure 1 here. 0 20 40 60 80 100 Sample Index 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 Am pl itu de Actual response Your prediction Question 2: Implement the framing of a text message according to the following communication protocol. 1. The information bits to be transmitted are broken into 5-bit blocks. If not enough bits are available to fill a complete block, zero padding is applied. 2. One start bit (value 1) and one stop bit (value 0) is added to each block to make a complete frame. 3. Frames are transmitted one after the other without any delay between. Modify the code in Q2.m to generate the bit stream after framing, and store it in the MATLAB variable framed_bs. When you run the code, MATLAB will return a figure window with two subplots: the top containing the original bit sequence bs and the bottom containing the bit stream after framing framed_bs. Note: % use the last two characters of your last name tx_msg = 'OW'; % e.g. CHOW Q2: Last Name: ____________________________ Place your figure 1 here. Question 3: You will design a frequency division multiplexing (FDM) scheme in order to send two messages through a shared communication channel. In Q3.m, the initial code loads two messages and stores them inside the variable signal(c,:), where c=1,2. Note that due to the low pass filtering applied, the two messages have different bandwidths, which are specified by the variable Fcutoff. The next part of the code should implement the FDM transmitters required to transmit these two messages simultaneously through the channel as the waveform stored inside the variable tx_wave. However, this part of the code is incorrect. Due to the incorrect design of the transmitter, the spectra of the two messages overlap, so that we cannot distinguish them. In figure 1, (the figures are the results of running the code) we can observe that most frequencies are already occupied, however there are two free bands that can be used to send our two messages. Figure 2 shows the amplitude spectrum of the two recovered messages. The two messages are different, so if you correct the code, you should see differences in their amplitude spectra. Finally, Figure 3 compares the original and the recovered messages in the time interval between 1 and 1.05 seconds. If you design the FDM properly, the plots of the original and the recovered signals should be nearly identical and the NMSE should be less than 0.5. Modify the code between the lines % % % % Revise the following code % % % % ... % % % % Do not change the code below % % % % Please do not change other parts of the code. Q3: List the two carrier frequencies here. Place three figures here. Question 4: You will use the Dijkstra's algorithm to compute the shortest path from a given source node to all other nodes of the network. In the Q4.m code, the network contains n_nodes nodes, and is represented by the matrix graph. The code first initializes two variables, est_cost, and predecessor. The n_nodes by 1 matrix, est_cost, contains the estimated cost of the best path from the source node (source) to each of the nodes in the network. For the neighbors of source, this is initialized to the cost of the direct link. For the other nodes it is initialized to infinity. The n_nodes by 1 matrix, predecessor, contains the predecessor node for each destination node. It is initialized to source for the neighbors of source, and zero otherwise, indicating that the predecessor is unknown. Recall that nodes are indexed from 1 to n_nodes. You will need to implement the code that iteratively updates est_cost and predecessor using Dijkstra's algorithm, so that they eventually contain the information required to find the best paths by backtracking. Recall from Lecture, that Dijkstra's algorithm does this by iteratively adding nodes to a set N' containing the nodes for which the best path is known. In the code, we define instead the vector queue, which is the complement of N', i.e., the set of nodes for which the best path is not yet finalized. In the implementation, the main iteration proceeds by first finding w, the node in queue that has the lowest path cost and deleting it from queue. For each of the nodes n remaining in queue, you should compute the cost of the path that first follows the best path to w (with cost est_cost(w)) and then goes directly from w to n (with cost graph(w,n)) and compare it with the current estimated cost (est_cost(n)). Note that the cost from w directly to n may be infinity if they are not neighbors. If the cost through w is smaller than est_cost(n), then the code should update est_cost(n) and set the predecessor(n) to w. The loop then repeats, and will eventually terminate when queue is empty. Please, revise the code between the lines: % % % % Revise the following code % % % % and % % % % Do not change the code below % % % % Do not change other parts of the code. The results is a n_nodes by n-nodes matrix path where each column shows the sequence of nodes followed from the source to each destination. The zeros at the end of each column of path are fillers, since the path is usually shorter than n_nodes long. It also displays the estimated cost of each path. Q4: Place the matrix “Path from source to any destination” here. Place the relative cost here. Question 5: Write a MATLAB script “Q5.m” to implement an encoder for the (6,3) block code. The code should generate all the valid codewords using the (6,3) block code With the (6,3) block code, the data to be encoded is first divided into blocks of three bits [D1 D2 D3]. Each codeword contains the data bits and three parity bits [P1 P2 P3]. The values of the parity bits are computed to ensure that all rows of the following table have even parity. Note that the message bits occur twice in this table as shown below: The final codeword is obtained by concatenating the data and parity bits [D1 D2 D3 P1 P2 P3]. Put all the valid codeword in a matrix call codeword and place the result here: Note: “codewords” should be generated using the coding scheme. If the codewords are generated using the MATLAB code without the coding scheme, zero marks! Q5: codeword = …. Your Q5.m will also be run and tested. --- End of Part I --- Part II: Determine what data and MAC addresses were sent (3 points each) Introduction By now, you have learnt many important concepts and theories about signals and communications. In this part, you will be given some signal outputs that have passed through different communication channels. From these output signals, you will need to find the original data and MAC addresses transmitted. Submission (online) Submit the table below by filling the original text messages and the MAC addresses sent through the five channels. Channel Data (text) MAC address (Hex) 1 2 3 4 5 In addition please submit your MATLAB code that you developed for finding the transmitted data for each of the 5 channels. The MATLAB code should be zipped in a zip file labeled as PartII.zip with ch1.m through ch5.m for channels 1-5 respectively. When running the code the resulting data and MAC results should be clearly displayed. Description: We have prepared 5 different sampled data streams that are the output of from 5 different communication channels. Each stream has a frame structure as shown: A frame consists of one start bit (value of 1) at the beginning and one stop bit (value of 0) at the end. Following the start bit, we will have a 48 bits MAC address and the remaining data bits. This is similar to the frame format in lab 3. A network device is identified by Media Access Control (MAC) addresses (also called a hardware address). These MAC addresses are typically written as a sequence of six two- character hex numbers, separated by colons as shown: F0:1C:AF:2A:7D:3E. The MAC address is converted into binary bits and put into the frame with MSB first. For example, F01C… will be 1111000000011100… The data in each sample data stream is different and it is a 10 character text string encoded by ASCII code into 8 binary bits. The bits are then encapsulated into the frame as data with MSB first and LSB last. This is the same as what we did in lab 2. Please refer to the ASCII code table as shown below: A training sequence with 500 ‘0’s, 500 ‘1’s and 500 ‘0’s were added before the frame and this is the same as what we did in lab 3. However, the data and the MAC addresses are unknown and they are different in each stream We then pass each frame through one of the five channels. The output will be given as a MATLAB mat file. The mat file contains the values of the received waveform. If channel coding is used in the transmission, the MAC address and data will be coded before framing so that the start and stop bits are not part of the code. The number of samples used to transmit one bit was 1 (SPB = 1). Channel 1: Noiseless without channel coding. Received waveform values: channel1_output.mat Channel 2: Low noise plus offset without channel coding. Received waveform values: channel2_output.mat Channel 3: Low noise plus offset with channel code. Received waveform with values: channel3_output.mat Channel code: (3,1,3) repetition code so that the bits transmitted is increased by a factor of 3. Channel 4: ISI and channel code. Received waveform with values: channel4_output.mat Channel code: (3,1,3) repetition code so that the bits transmitted is increased by a factor of 3. Channel 5: Low noise plus ISI and channel code. Received waveform with values: channel5_output.mat Channel code: (8,4,3) block code so that the bits transmitted is increased by a factor of 2. Instructions: Download ‘PartII.zip’ from the canvas assignment page. Unzip it. Open MATLAB and select the 'PartII' folder and you can find the mat files in the 'Current Folder'. Hints: you can load the mat file and it will appear as your rx_wave. (x is the channel number) >> load channelx_output What you need to do is to determine what data were sent and which MAC address were sent as the project outcome. You may reuse code that you have previously developed during the lab work over the semester. Please provide your answers in the table format listed above and save the table in the same pdf file with your answers in Part I. In addition please submit your MATLAB code for each of the 5 channels. The MATLAB code should be zipped in a zip file labeled as PartII.zip with ch1.m through ch5.m and clearly list the resulting data output if the code is run. Submission summary: Part I: • The answers as specified. • A zip file (PartI.zip) with all the runnable MATLAB code. Part II: • A filled table as specified. • A zip file (PartII.zip) with all the runnable MATLAB code. The answers in part I and the table in part II should be put in a SINGLE pdf file. ___________________________________________________________________________ Three files should be submitted together in one submission. Project.pdf PartI.zip PartII.zip --- End of Project ---
欢迎咨询51作业君