Question: Complete step by step matlab solution needed for communication project. Project Summary: In this project, pulse-code modulation and encoding is performed on a cosine wave
Complete step by step matlab solution needed for communication project.


Project Summary: In this project, pulse-code modulation and encoding is performed on a cosine wave message. An "analog, continuous-time" signal is sampled using supplied MATLAB code. Your task is to complete the PCM to allow digital transmission: you will perform quantization and bit encoding operations on the signal. 2 Project Description and Assignment Enter the following MATLAB code into a .m file and save as project4.m": %Pulse-code modulation %This code creates a continuous-time function, samples the function at %discrete instants in time, and quantizes the results, resulting in a %bitstream representing the sampled data. The project shows the conversion %of a signal from a continuous-time, analog signal to a discrete-time, %digital signal. t=0:0.00001:0.1; m = 5*cos(200*pi*t); %the continuous-time function figure; plot(t,m); %Sample the function; the Nyquist rate is 200 Hz. Sample at 400 Hz %instead. The sample time is 1/400 = 0.0025. Ts = 0.0025; nstop = 0.1/0.0025; n = 1:nstop; ms = 5 * cos(200*pi*n*Ts); %the sampled signal ms is a vector containing the sample values figure; plot(n,ms); This code provides for the sampling of a continuous-time message signal m(t) = 5 cos(2007) Notice that the sampling begins at T = 0.0025 and the signal is sampled every T, = 0.0025 seconds. The signal bandwidth is 100 Hz, so the use of the sampling rate fs = 1/T, = 400 Hz is satisfactory (>2B). At the end of the code, a sequence ms[n] exists. This is an analog, discrete-time signal (it is merely a sequence of numbers). To complete the pulse-code modulation, this sequence of numbers must be quantized and then represented by bits. You will perform these operations by appropriate MATLAB coding. Your assignment is as follows: 1. Copy the existing code into a .m file. The existing code plots the continuous-time, analog signal as a function of time (Figure 1). It then samples the signal at a rate f. Hz and plots the sampled signal versus the sample number (Figure 2). 2. Add code to quantize the signal into L = 16 levels covering the range between -5 and 5 (use my = 5). It is likely you will want to use a while or for loop to accomplish this. Plot the quantized signal as a function of sample number (Figure 3). Convert the quantized values to signal level numbers (i.e. 1 through 16 with 1 corresponding to the lowest quantized value and 16 corresponding to the highest quantized value). Plot the quantized signal versus sample number (Figure 4). 3 3. The quantized values can now be converted into a four-bit representation of the signal because n n = log2 L = log2 16 = 4 bits. Create a bitstream representing this signal. Note that you will now have four bits for each sample. Each bit should be a l or a 0. You will likely need to create a "for" or "while loop to accomplish this. Plot the bit values versus bit number (Figure 5). Project Summary: In this project, pulse-code modulation and encoding is performed on a cosine wave message. An "analog, continuous-time" signal is sampled using supplied MATLAB code. Your task is to complete the PCM to allow digital transmission: you will perform quantization and bit encoding operations on the signal. 2 Project Description and Assignment Enter the following MATLAB code into a .m file and save as project4.m": %Pulse-code modulation %This code creates a continuous-time function, samples the function at %discrete instants in time, and quantizes the results, resulting in a %bitstream representing the sampled data. The project shows the conversion %of a signal from a continuous-time, analog signal to a discrete-time, %digital signal. t=0:0.00001:0.1; m = 5*cos(200*pi*t); %the continuous-time function figure; plot(t,m); %Sample the function; the Nyquist rate is 200 Hz. Sample at 400 Hz %instead. The sample time is 1/400 = 0.0025. Ts = 0.0025; nstop = 0.1/0.0025; n = 1:nstop; ms = 5 * cos(200*pi*n*Ts); %the sampled signal ms is a vector containing the sample values figure; plot(n,ms); This code provides for the sampling of a continuous-time message signal m(t) = 5 cos(2007) Notice that the sampling begins at T = 0.0025 and the signal is sampled every T, = 0.0025 seconds. The signal bandwidth is 100 Hz, so the use of the sampling rate fs = 1/T, = 400 Hz is satisfactory (>2B). At the end of the code, a sequence ms[n] exists. This is an analog, discrete-time signal (it is merely a sequence of numbers). To complete the pulse-code modulation, this sequence of numbers must be quantized and then represented by bits. You will perform these operations by appropriate MATLAB coding. Your assignment is as follows: 1. Copy the existing code into a .m file. The existing code plots the continuous-time, analog signal as a function of time (Figure 1). It then samples the signal at a rate f. Hz and plots the sampled signal versus the sample number (Figure 2). 2. Add code to quantize the signal into L = 16 levels covering the range between -5 and 5 (use my = 5). It is likely you will want to use a while or for loop to accomplish this. Plot the quantized signal as a function of sample number (Figure 3). Convert the quantized values to signal level numbers (i.e. 1 through 16 with 1 corresponding to the lowest quantized value and 16 corresponding to the highest quantized value). Plot the quantized signal versus sample number (Figure 4). 3 3. The quantized values can now be converted into a four-bit representation of the signal because n n = log2 L = log2 16 = 4 bits. Create a bitstream representing this signal. Note that you will now have four bits for each sample. Each bit should be a l or a 0. You will likely need to create a "for" or "while loop to accomplish this. Plot the bit values versus bit number (Figure 5)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
