0% found this document useful (0 votes)
23 views

Assignment No. 2

This document contains Muhammad Yaqoob's submission of Assignment No. 2 for the Communication Systems course. The assignment includes 3 questions analyzing an audio file with MATLAB, discussing topics related to wireless communication systems, and simulating a digital communication system in MATLAB. Code is provided for reading an audio file, quantizing it, and computing SNR. Blockchain communication, SDR for 5G, and broadband communication are also analyzed. Finally, a MATLAB simulation transmits and receives a binary message using FSK modulation and demodulation.

Uploaded by

Asad abdullah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Assignment No. 2

This document contains Muhammad Yaqoob's submission of Assignment No. 2 for the Communication Systems course. The assignment includes 3 questions analyzing an audio file with MATLAB, discussing topics related to wireless communication systems, and simulating a digital communication system in MATLAB. Code is provided for reading an audio file, quantizing it, and computing SNR. Blockchain communication, SDR for 5G, and broadband communication are also analyzed. Finally, a MATLAB simulation transmits and receives a binary message using FSK modulation and demodulation.

Uploaded by

Asad abdullah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Assignment No.

2
Communication Systems

Submitted to:
Sir Dr. Engr. Muhammad Saleem

Submitted by:
Name: Muhammad Yaqoob
Reg No: ELEN-201101019
Assignment No.2 (CLO-2)
Question No.1: Analyze the audio file using MATLAB Tool as?
Task 1: Read audio file
Task 2: Quantize audio signal
Task 3: Compute SNR
Private Functions
Answer. Following is the MATLAB Code:

% Task 1: Read audio file


filename = 'audio.wav'; % Provide the path to your audio file
[audio, fs] = audioread(filename);

% Task 2: Quantize audio signal


bits = 8; % Number of bits for quantization
quantized_audio = quantize(audio, bits);

% Task 3: Compute SNR


noise = audio - quantized_audio;
signal_power = sum(audio.^2) / length(audio);
noise_power = sum(noise.^2) / length(noise);
snr = 10 * log10(signal_power / noise_power);

% Private Functions
function quantized_signal = quantize(signal, bits)
% Normalize the signal to the range [-1, 1]
max_value = max(abs(signal));
normalized_signal = signal / max_value;

% Quantize the normalized signal


quantization_levels = 2^bits;
quantized_signal = round(normalized_signal * (quantization_levels-1));

% Scale the quantized signal back to the original range


quantized_signal = quantized_signal / (quantization_levels-1) * max_value;
end

In this code, replace 'audio.wav' with the actual path to your audio file. Make sure the audio file
is in a format supported by MATLAB (e.g., WAV, MP3).

The code reads the audio file using the audioread function and stores the audio samples in the
audio variable. The sample rate is stored in the fs variable.

Next, the quantize function quantizes the audio signal using a specified number of bits. The
quantization is done by normalizing the signal to the range [-1, 1], quantizing it to the desired
number of levels, and then scaling it back to the original range.
Finally, the code computes the signal-to-noise ratio (SNR) by calculating the power of the
original audio signal and the power of the quantization noise. The SNR is expressed in decibels
(dB) using the formula SNR = 10 * log10(signal_power / noise_power).

Question No.2: Analyze the following topics in term of wireless communication systems:
1. Block chain-based Communication
2. SD Radio for 5G
3. Broadband Communication
Answer.
Wireless Communication Systems Analysis

Blockchain-based Communication

Blockchain technology has transformative potential in wireless communication systems, offering


enhanced security, trust, and efficiency. It introduces decentralized and distributed ledgers that
record transactions and data exchanges. Key aspects to consider include:
• Security: Blockchain ensures secure communication through cryptographic algorithms
and consensus mechanisms. It eliminates single points of failure and reduces the risk of
malicious attacks.
• Privacy: With techniques like zero-knowledge proofs and encryption, blockchain
enhances privacy by giving users control over their personal data.
• Peer-to-peer Communication: Blockchain facilitates direct device-to-device
communication, enabling decentralized networks and applications.
• Smart Contracts: Blockchain-based smart contracts automate agreements, governing
service provisioning, billing, and quality-of-service guarantees.
Software-Defined Radio (SDR) for 5G

Software-Defined Radio (SDR) technology brings significant advantages to 5G wireless


communication systems. It offers flexibility through software-based configuration and
reconfiguration of radio devices. Key considerations include:
• Spectrum Efficiency: SDR enables dynamic spectrum access, optimizing radio resource
allocation in real-time.
• Interoperability: SDR promotes seamless handover between networks by facilitating the
implementation of multiple communication protocols on the same hardware.
• Upgradability: SDR allows for easy upgrades and evolution through software updates,
reducing hardware replacement costs.
• Cost Reduction: By utilizing general-purpose hardware and software, SDR reduces
equipment and infrastructure costs.
• Flexibility: SDR adapts to changing network requirements, enabling dynamic changes in
modulation schemes, bandwidth allocation, and radio configurations.

Broadband Communication

Broadband communication involves high-speed data transmission over a wide range of


frequencies. It plays a vital role in modern wireless communication systems. Key considerations
include:
• High Data Rates: Broadband systems support the transmission of large data volumes,
high-quality multimedia content, and real-time applications.
• Multiple Access Techniques: Broadband systems utilize techniques such as FDMA,
TDMA, CDMA, and OFDMA to efficiently share spectrum among multiple users.
• Fiber Optic and Wireless Integration: Broadband systems integrate fiber optic cables for
high-capacity backbone connections and wireless links for end-user connectivity.

Question No.3: A simulation of a complete digital communication system with different modulation
schemes in MATLAB for transmitting and receiving text messages.
Answer. Code:
clc;
clear all;
close all;
x=[0 1 1 0 0 0 1 0]; % Binary Information
bp=.000001; % bit period
disp('Transmitted bit stream :');
disp(x);
% Binary data in digital form
bit=[];
for n=1:1:length(x)
if x(n)==1;
se=ones(1,100);
else x(n)==0;
se=zeros(1,100);
end
bit=[bit se];
end
t1=bp/100:bp/100:100*length(x)*(bp/100);
subplot(3,1,1);
plot(t1,bit,'lineWidth',2.5);grid on;
axis([ 0 bp*length(x) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('message in digital');
% Binary-FSK modulation %
A=5; % Amplitude of carrier signal
rb=1/bp; % bit rate
f1=rb*8; % carrier frequency for information as 1
f2=rb*2; % carrier frequency for information as 0
t2=bp/99:bp/99:bp;
ss=length(t2);
m=[];
for (i=1:1:length(x))
if (x(i)==1)
y=A*cos(2*pi*f1*t2);
else
y=A*cos(2*pi*f2*t2);
end
m=[m y];
end
t3=bp/99:bp/99:bp*length(x);
subplot(3,1,2);
plot(t3,m);
xlabel('time(sec)');
ylabel('amplitude(volt)');
title('Binary FSK modulation signal');
% Binary FSK demodulation
mn=[];
for n=ss:ss:length(m)
t=bp/99:bp/99:bp;
y1=cos(2*pi*f1*t); % carrier siignal for information 1
y2=cos(2*pi*f2*t); % carrier siignal for information 0
mm=y1.*m((n-(ss-1)):n);
mmm=y2.*m((n-(ss-1)):n);
t4=bp/99:bp/99:bp;
z1=trapz(t4,mm) % intregation
z2=trapz(t4,mmm) % intregation
zz1=round(2*z1/bp)
zz2= round(2*z2/bp)
if(zz1>A/2) % logic lavel= (0+A)/2 or (A+0)/2 or 2.5 ( in this case)
a=1;
else(zz2>A/2)
a=0;
end
mn=[mn a];
end
disp(' Demodulated data :');
disp(mn);
%XXXXX Representation of binary information as digital signal which achived
%after demodulation
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
bit=[];
for n=1:length(mn);
if mn(n)==1;
se=ones(1,100);
else mn(n)==0;
se=zeros(1,100);
end
bit=[bit se];
end
t4=bp/100:bp/100:100*length(mn)*(bp/100);
subplot(3,1,3)
plot(t4,bit,'LineWidth',2.5);grid on;
axis([ 0 bp*length(mn) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel(' time(sec)');
title('Demod data in digital form');
Output:
Transmitted bit stream : ans = logical 1
0 1 1 0 0 0 1 0
z1 = -4.7142e-08
z1 = -4.7142e-08 z2 = 2.4499e-06
z2 = 2.4499e-06 zz1 = 0
zz1= 0 zz2 = 5
zz2 = 5
ans = logical 1
ans = logical 1

z1 = 2.4555e-06
z2 = -4.7142e-08
zz1 = 5 z1 = 2.4555e-06
zz2 = 0 z2 = -4.7142e-08
z1 = 2.4555e-06 zz1 = 5
z2 = -4.7142e-08 zz2 = 0
zz1 = 5 z1 = -4.7142e-08
zz2 = 0 z2 = 2.4499e-06
z1 = -4.7142e-08 zz1 = 0
z2 = 2.4499e-06 zz2 = 5
zz1 = 0
zz2 = 5 ans = logical 1

Demodulated data :
ans = logical 1 0 1 1 0 0 0 1 0

z1 = -4.7142e-08
z2 = 2.4499e-06
zz1 = 0
zz2 = 5
The File of Matalb is also attached with the Assignment.

You might also like