We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 5
ASSIGNMENT-1
Programming using Octave
submitted by Mary Roshia Peter 963321106060 52 BE/ECE Program : % Clear the command window and any variables in the workspaceclearclc% Define the number of data pointsN = 1000; % number of data% Define the size of the signal constellationmlevel = 4; % size of signal constellation% Calculate the number of bits per symbolk = log2(mlevel); % number of bits per symbol% Generate random binary bit stream of length Nx = randi([0 1], N, 1); % signal generation in bit stream% Convert the bit stream into symbols using binary to decimal conversion% Reshape the binary stream into a matrix with each column representing a symbol% and each row representing a set of bits for each symbol% 'left-msb' indicates that the most significant bit (MSB) is on the left sidexsym = bi2de(reshape(x, k, length(x)/k).', 'left-msb'); % convert the bit stream into symbol stream% Modulate the symbols using Quadrature Amplitude Modulation (QAM)xmod = qammod(xsym, mlevel); % modulation% Store the modulated symbols in a variable for transmissionTx_x = xmod; % Define the Signal-to-Noise Ratio (SNR) in decibelsSNR = 5;% Add Additive White Gaussian Noise (AWGN) to the transmitted signalTx_awgn = awgn(Tx_x, SNR, 'measured'); % adding AWGN% Store the received signal after noise additionRx_x = Tx_awgn; % Received signal% Demodulate the received signal to recover the symbolsRx_x_demod = qamdemod(Rx_x, mlevel); % demodulation% Convert the demodulated symbols back to binary bitsz = de2bi(Rx_x_demod, 'left-msb'); % Convert integers to bits.% Convert the matrix of bits back to a vectorRx_x_BitStream = reshape(z.', prod(size(z)), 1); % Convert z from a matrix to a vector.% Calculate the Bit Error Rate (BER) by comparing the transmitted and received bits[number_of_errors, bit_error_rate] = biterr(x, Rx_x_BitStream); % Calculate BER% Plot each step of the processsubplot(5,2,[1 2]); stem(x(1:200),'filled'); title('Transmitted Bit Stream');subplot(5,2,[3 4]); stem(xsym(1:50),'filled'); title('Transmitted Symbol');subplot(5,2,5); plot(real(Tx_x), imag(Tx_x), 'go', 'MarkerFaceColor', [0, 1, 0]); axis([-mlevel/2 mlevel/2 -mlevel/2 mlevel/2]);subplot(5,2,6); plot(real(Rx_x), imag(Rx_x), 'go', 'MarkerFaceColor', [0, 1, 0]); axis([-mlevel/2 mlevel/2 -mlevel/2 mlevel/2]);subplot(5,2,[7 8]); stem(Rx_x_demod(1:50),'filled'); title('Received Symbol');subplot(5,2,[9 10]); stem(Rx_x_BitStream(1:200),'filled'); title('Received BitStream'); Output: THANK YOU