• Tidak ada hasil yang ditemukan

Mobile Communications-Practical

N/A
N/A
Rahma Noori

Academic year: 2024

Membagikan "Mobile Communications-Practical "

Copied!
12
0
0

Teks penuh

(1)

Al-Kitab University

College of Engineering Technology Computer Technology Engineering Dep .

4th stage

Mobile Communications - Practical Prepared by:

Dr. Yaseen. A Alsumaidaee

2022-2023

(2)

Experiment no. 1 :

How does Frequency Division Duplexing (FDD) impact the transmission and reception of signals in separate frequency bands, and what is the effect of simulating a noisy channel on the forward and reverse channels in a wireless communication system?

Objectives :

1. To understand the concept of Frequency Division Duplexing (FDD) and its role in wireless communication.

2. To simulate a simple FDD communication system in MATLAB with forward (downlink) and reverse (uplink) channels.

3. To define and manipulate key signal parameters, including sampling rate, frequency, and signal duration.

4. To generate and visualize signals representing the forward channel (base station to mobile device) and reverse channel (mobile device to base station).

5. To introduce controlled noise into the signals to model real-world communication channel conditions.

6. To plot and analyze both the transmitted and received signals to observe the effects of FDD and noise on signal quality.

Discussion

• Frequency Division Duplexing (FDD) is a fundamental technique in wireless communication where transmission (downlink) and reception (uplink) occur in separate frequency bands. In this MATLAB example, we aimed to understand the practical implications of FDD on signal transmission and reception and how the addition of noise affects the communication.

• The code begins by defining key parameters, including the sample rate, forward and reverse channel frequencies, signal duration, and the Signal-to-Noise Ratio (SNR) to control the level of noise.

• A time vector t is created to represent the time axis for the signals, ensuring that both forward and reverse channels share the same time frame.

• Two signals are generated: one for the forward channel (downlink), simulating communication from a base station to a mobile device, and the other for the reverse channel (uplink), representing communication from a mobile device to a base station.

The signals are sinusoidal, representing a simplified version of the transmitted signals.

(3)

• To model the real-world influence of a noisy channel, the awgn function is employed to add white Gaussian noise to both the forward and reverse channel signals. This addition of noise mimics the effects of channel interference, a common occurrence in wireless communication.

• Finally, the code plots both the transmitted and received signals. The forward channel signal appears sinusoidal and noise-affected, while the reverse channel exhibits similar characteristics. The visualization allows us to observe how FDD affects signal transmission and reception and how the added noise influences signal quality.

In summary, this experiment showcases the importance of FDD in wireless communication, separating the transmission and reception in different frequency bands. Additionally, it highlights the effects of noise on signal quality, which is a critical consideration in real-world communication systems.

Coding in Matlab:

Frequency Division Duplexing (FDD) Example in MATLAB:

FDD is a technique where the transmission and reception occur in separate frequency bands. Here's a MATLAB code example to simulate FDD

1. Parameter Definitions:

sample_rate = 1e6; % Sample rate in Hz

forward_frequency = 900e6; % Forward channel frequency in Hz reverse_frequency = 850e6; % Reverse channel frequency in Hz duration = 1; % Duration of the signal in seconds

SNR_dB = 20; % Signal-to-Noise Ratio (in dB)

sample_rate: Specifies the rate at which the signal will be sampled. In this code, it's set to 1 MHz (1e6 Hz), meaning there will be one million samples per second .

forward_frequency and reverse_frequency: These represent the carrier frequencies for the forward (downlink) and reverse (uplink) channels, respectively, specified in Hertz (Hz .)

duration: It sets the duration of the signals in seconds, which is set to 1 second in this code .

SNR_dB: The Signal-to-Noise Ratio (SNR) in decibels (dB) determines the ratio of the signal's power to the noise power. An SNR of 20 dB indicates that the signal is 20 decibels stronger than the noise.

2. Creating a Time Vector:

t = 0:1/sample_rate:duration;

%This line creates a time vector t that represents time values at a high resolution. It starts from 0 seconds, increments in steps of 1/sample_rate seconds, and ends at the specified duration. This time vector is used to generate the signals over time.

3. Generating the Forward Channel Signal:

forward_signal = cos(2 * pi * forward_frequency * t);

%The code generates the forward channel signal by creating a cosine waveform modulated by forward_frequency over time.

This simulates a signal transmitted from a base station to a mobile device in the forward channel (downlink).

(4)

4. Adding Noise to the Forward Signal:

forward_signal_with_noise = awgn(forward_signal, SNR_dB);

% To simulate the presence of noise in a real-world communication channel, the awgn function is used. It adds white Gaussian noise (AWGN) to the forward_signal. The noise level is determined by the SNR_dB parameter. An SNR of 20 dB means the signal is much stronger than the added noise.

5.Generating the Reverse Channel Signal:

reverse_signal = cos(2 * pi * reverse_frequency * t);

% Similar to the forward channel, this line generates the reverse channel signal by creating a cosine waveform modulated by reverse_frequency over time. This simulates a signal transmitted from a mobile device to a base station in the reverse channel (uplink).

6. Adding Noise to the Reverse Signal:

reverse_signal_with_noise = awgn(reverse_signal, SNR_dB);

% The awgn function is again used to add noise to the reverse channel signal. This is done to simulate noise on the uplink side of the communication.

7. Plotting the Signals:

figure;

subplot(2, 1, 1);

plot(t, forward_signal_with_noise);

title('Forward Channel (Downlink)');

xlabel('Time (s)');

ylabel('Amplitude');

grid on;

subplot(2, 1, 2);

plot(t, reverse_signal_with_noise);

title('Reverse Channel (Uplink)');

xlabel('Time (s)');

ylabel('Amplitude');

grid on;

% Finally, the code creates a figure with two subplots. It plots the forward channel signal with noise in the first subplot and the reverse channel signal with noise in the second subplot. It also adds titles, labels, and grid lines for clarity in the visual representation of the signals over time.

Experiment no. 2 :

What is the purpose of the provided MATLAB code for Time Division Duplexing (TDD), and what does it simulate?

Objectives

1. To understand the concept of Time Division Duplexing (TDD) and how it shares a single radio channel in time.

2. To create a visual representation of signal transmission in a TDD system.

3. To familiarize oneself with MATLAB functions for plotting and visualizing data.

4. To demonstrate how TDD allocates time slots for uplink (mobile to base station) and downlink (base station to mobile) communication.

(5)

Discussion

• Discuss the concept of Time Division Duplexing (TDD) and its importance in wireless communication.

• Explain how TDD shares a single radio channel by dividing time into slots.

• Describe the parameters used in the code, such as total_time_slots and uplink_slots, and their significance in simulating TDD.

• Discuss the role of the signal vector and how it represents the signal direction in each time slot.

• Explain the use of the stem function for plotting the TDD signal and how it differentiates between uplink and downlink.

• Discuss the purpose of setting y-axis limits using ylim and the labels added to the plot using xlabel, ylabel, and title.

• Describe the significance of adding time slot labels to the plot and how this enhances visualization.

• Explore the adaptability of the code to different TDD scenarios by adjusting the parameters, such as total_time_slots and uplink_slots.

• Discuss potential real-world applications of TDD and how this code can be a starting point for more complex TDD simulations.

• Consider the challenges and complexities of TDD systems, including synchronization and timing sensitivity.

Coding in Matlab:

% Parameters

total_time_slots = 10; % Total number of time slots

uplink_slots = 4; % Number of time slots for uplink (mobile to base station)

% Create an empty signal vector

signal = zeros(1, total_time_slots);

% Assign values for uplink and downlink

signal(1:uplink_slots) = 1; % 1 represents uplink (mobile to base station)

signal(uplink_slots+1:end) = 2; % 2 represents downlink (base station to mobile)

% Create a figure to plot the TDD signal figure;

stem(1:total_time_slots, signal, 'Marker', 'none', 'LineWidth', 2);

ylim([0, 3]);

(6)

xlabel('Time Slots');

ylabel('Signal Direction (1: Uplink, 2: Downlink)');

title('Time Division Duplexing (TDD) Signal');

grid on;

% Adding time slot labels

for slot = 1:total_time_slots

end

% Parameters

total_time_slots = 10; % Total number of time slots

uplink_slots = 4; % Number of time slots for uplink (mobile to base station)

% These lines define the parameters for the TDD simulation. total_time_slots specifies the total number of time slots, and uplink_slots specifies how many of these slots are allocated for uplink communication (from mobile to base station).

% Create an empty signal vector signal = zeros(1, total_time_slots);

%This line initializes an empty signal vector called signal with a length of total_time_slots. This vector will represent the direction of signal transmission in each time slot, where 1 indicates uplink and 2 indicates downlink.

% Assign values for uplink and downlink

signal(1:uplink_slots) = 1; % 1 represents uplink (mobile to base station)

signal(uplink_slots+1:end) = 2; % 2 represents downlink (base station to mobile)

%These lines set the values in the signal vector to represent the uplink and downlink directions. The first uplink_slots slots are assigned the value 1 to represent uplink, and the remaining slots are assigned the value 2 to represent downlink.

% Create a figure to plot the TDD signal figure;

stem(1:total_time_slots, signal, 'Marker', 'none', 'LineWidth', 2);

ylim([0, 3]);

xlabel('Time Slots');

ylabel('Signal Direction (1: Uplink, 2: Downlink)');

title('Time Division Duplexing (TDD) Signal');

grid on;

%These lines create a figure for plotting the TDD signal. The figure command initializes a new figure. The stem function is used to create a stem plot where the x-axis represents the time slots (from 1 to total_time_slots) and the y-axis represents the signal direction. 'Marker', 'none' specifies that there are no markers on the stem lines, and 'LineWidth', 2 sets the line width.

ylim([0, 3]) sets the y-axis limits to show values between 0 and 3, representing uplink, downlink, and any other potential values.The xlabel, ylabel, and title functions are used to add labels to the plot, and grid on enables grid lines in the plot.

% Adding time slot labels for slot = 1:total_time_slots

text(slot, -0.1, ['Slot ', num2str(slot)], 'HorizontalAlignment', 'center');

end

%These lines add labels to the time slots at the bottom of the plot. A loop iterates through each time slot, and the text function is used to add labels to each time slot, indicating its number.

(7)

Experiment no. 3 :

Compare and contrast Unicast, Broadcast, and Multicast types of communication in networking. Provide practical examples in Matlab program.

Objectives:

1. Understand the Basics:

• Define Unicast, Broadcast, and Multicast in the context of network communication.

• Explain how data is transmitted in each type.

2. Practical Examples:

• Provide practical examples of scenarios where Unicast, Broadcast, and Multicast transmissions are applicable.

• Illustrate the differences between the three types using real-world examples.

3. Advantages and Disadvantages:

• Analyze the advantages of using Unicast, Broadcast, and Multicast in terms of efficiency, bandwidth usage, and scalability.

• Discuss the potential disadvantages or challenges associated with each type.

4. Network Efficiency:

• Compare the efficiency of Unicast, Broadcast, and Multicast transmissions in different network scenarios.

• Evaluate which type is more suitable for certain network conditions.

Discussion:

1. Unicast:

• Example: Consider a scenario where a user accesses a website. Discuss how the communication between the user's device and the web server represents Unicast.

• Applications: Explore applications like HTTP, FTP, and SMTP that commonly use Unicast for point-to-point communication.

• Advantages/Disadvantages: Discuss how Unicast ensures dedicated communication but may lead to scalability challenges in large networks.

2. Broadcast:

• Example: Think about a scenario where a device is searching for a DHCP server during network initialization. Explain how DHCP discovery involves Broadcast.

• Applications: Highlight the use of Broadcast in protocols like ARP and DHCP.

• Advantages/Disadvantages: Discuss how Broadcast simplifies communication to all devices but can lead to increased network traffic.

3. Multicast:

• Example: Consider a scenario where a video stream is sent to multiple subscribers simultaneously. Explain how this represents Multicast communication.

(8)

• Applications: Discuss protocols like IGMP and PIM that facilitate Multicast communication.

• Advantages/Disadvantages: Explore how Multicast conserves bandwidth by sending data only to interested recipients but may require additional management.

Coding in Matlab:

% Unicast Transmission Example

% Source device

source = 'Source Device';

% Destination device

destination = 'Destination Device';

% Plotting the unicast transmission figure;

plot([0, 1], [0, 0], '-o'); % Arrow from source to destination text(0.5, 0.1, 'Unicast', 'HorizontalAlignment', 'center');

text(0, 0.05, source, 'HorizontalAlignment', 'right');

text(1, 0.05, destination, 'HorizontalAlignment', 'left');

axis off;

%% Broadcast Transmission Example

% Source device

source = 'Source Device';

% Plotting the broadcast transmission figure;

annotation('arrow', [0.1, 0.9], [0.5, 0.5], 'HeadWidth', 10, 'HeadLength', 10);

text(0.5, 0.55, 'Broadcast', 'HorizontalAlignment', 'center');

text(0.1, 0.45, source, 'HorizontalAlignment', 'right');

text(0.9, 0.45, 'Receiver 1', 'HorizontalAlignment', 'left');

text(0.9, 0.35, 'Receiver 2', 'HorizontalAlignment', 'left');

text(0.9, 0.25, 'Receiver 3', 'HorizontalAlignment', 'left');

axis off;

% Multicast Transmission Example

% Source device

source = 'Source Device';

% Plotting the multicast transmission figure;

annotation('arrow', [0.1, 0.9], [0.5, 0.5], 'HeadWidth', 10,

'HeadLength', 10);

(9)

text(0.5, 0.55, 'Multicast', 'HorizontalAlignment', 'center');

text(0.1, 0.45, source, 'HorizontalAlignment', 'right');

text(0.9, 0.45, 'Receiver 1', 'HorizontalAlignment', 'left');

text(0.9, 0.35, 'Receiver 2', 'HorizontalAlignment', 'left');

text(0.9, 0.25, 'Receiver 3', 'HorizontalAlignment', 'left');

axis off;

1.Unicast Transmission:

%source = 'Source Device';: Assigns the label 'Source Device' to the variable source.

%destination = 'Destination Device';: Assigns the label 'Destination Device' to the variable destination.

%figure;: Creates a new figure for plotting.

%plot([0, 1], [0, 0], '-o');: Plots a line with markers to represent the unicast transmission from source to destination.

%text(0.5, 0.1, 'Unicast', 'HorizontalAlignment', 'center');: Adds text 'Unicast' at the center of the line.

%text(0, 0.05, source, 'HorizontalAlignment', 'right');: Adds text 'Source Device' to the right of the starting point.

%text(1, 0.05, destination, 'HorizontalAlignment', 'left');: Adds text 'Destination Device' to the left of the ending point.

%axis off;: Turns off the axis to focus on the illustration.

2.Broadcast Transmission:

%source = 'Source Device';: Same as in Unicast.

%figure;: Creates a new figure for plotting.

%annotation('arrow', [0.1, 0.9], [0.5, 0.5], 'HeadWidth', 10, 'HeadLength', 10);: Adds an arrow from the source to represent the broadcast.

%text(0.5, 0.55, 'Broadcast', 'HorizontalAlignment', 'center');: Adds text 'Broadcast' at the center of the arrow.

%text(0.1, 0.45, source, 'HorizontalAlignment', 'right');: Adds text 'Source Device' to the right of the starting point.

%text(0.9, 0.45, 'Receiver 1', 'HorizontalAlignment', 'left');: Adds text 'Receiver 1' to the left of the arrow.

%text(0.9, 0.35, 'Receiver 2', 'HorizontalAlignment', 'left');: Adds text 'Receiver 2' below 'Receiver 1'.

%text(0.9, 0.25, 'Receiver 3', 'HorizontalAlignment', 'left');: Adds text 'Receiver 3' below 'Receiver 2'.

%axis off;: Turns off the axis.

3.Multicast Transmission:

%source = 'Source Device';: Same as in Unicast and Broadcast.

%figure;: Creates a new figure for plotting.

%annotation('arrow', [0.1, 0.9], [0.5, 0.5], 'HeadWidth', 10, 'HeadLength', 10);: Adds an arrow from the source to represent the multicast.

%text(0.5, 0.55, 'Multicast', 'HorizontalAlignment', 'center');: Adds text 'Multicast' at the center of the arrow.

(10)

%text(0.1, 0.45, source, 'HorizontalAlignment', 'right');: Adds text 'Source Device' to the right of the starting point.

%text(0.9, 0.45, 'Receiver 1', 'HorizontalAlignment', 'left');: Adds text 'Receiver 1' to the left of the arrow.

%text(0.9, 0.35, 'Receiver 2', 'HorizontalAlignment', 'left');: Adds text 'Receiver 2' below 'Receiver 1'.

%text(0.9, 0.25, 'Receiver 3', 'HorizontalAlignment', 'left');: Adds text 'Receiver 3' below 'Receiver 2'.

%axis off;: Turns off the axis.

Experiment no. 4 :

Using MATLAB, demonstrate the representation of an analog signal (G1) and its discretized version in a digital system (G2). Consider a basic analog sine wave as the continuous signal.

Discuss the process of converting the analog signal to a digital signal and visualize the comparison.

Objectives:

1. Analog Signal Generation (G1):

▪ Generate a continuous analog sine wave.

▪ Plot the analog signal.

2. Digital Signal Generation (G2):

▪ Discretize the analog signal to represent the digital version.

▪ Plot the digital signal.

3. Comparison Visualization:

▪ Display the analog and digital signals for visual comparison.

▪ Use appropriate plotting functions to represent continuous and discrete signals.

Discussion:

▪ Discuss the concept of an analog signal in G1, which is continuous and represented by a sine wave in this example.

▪ Explain the process of discretizing the analog signal to obtain a digital version in G2.

▪ Compare the characteristics of the analog and digital signals, considering aspects such as sampling rate and representation.

▪ Highlight the importance of sampling rate in converting from analog to digital and its impact on signal accuracy.

▪ Visualize the representation of both signals in a single plot for easy comparison.

Coding in Matlab:

% G1: Analog System

% Define parameters for the analog signal

(11)

frequency = 2; % Frequency of the sine wave

duration = 2; % Duration of the signal in seconds

sampling_rate_analog = 1000; % Sampling rate for analog signal

% Generate the analog signal (continuous sine wave) t_analog = linspace(0, duration, duration *

sampling_rate_analog);

analog_signal = sin(2 * pi * frequency * t_analog);

% Plot the analog signal figure;

subplot(2, 1, 1);

plot(t_analog, analog_signal);

title('Analog Signal');

xlabel('Time (s)');

ylabel('Amplitude');

% G2: Digital System

% Define parameters for the digital system

sampling_rate_digital = 100; % Sampling rate for digital signal

% Discretize the analog signal to obtain the digital signal t_digital = 0:1/sampling_rate_digital:duration;

digital_signal = sin(2 * pi * frequency * t_digital);

% Plot the digital signal subplot(2, 1, 2);

stem(t_digital, digital_signal, 'r', 'filled');

title('Digital Signal (Discretized)');

xlabel('Time (s)');

ylabel('Amplitude');

% Display the stem plot on top of the analog signal plot for comparison

hold on;

stem(t_analog, analog_signal, 'b', 'LineWidth', 1.5, 'LineStyle', '--', 'Marker', 'none');

hold off;

legend('Digital Signal', 'Analog Signal (Continuous)', 'Location', 'northoutside');

% Adjust plot layout

title('Representation of Analog and Digital Systems');

(12)

Now, let's go through the MATLAB code with explanations for each line:

% G1: Analog System

frequency = 1;: %This line sets the frequency of the sine wave in Hertz. In signal processing, the frequency determines how many oscillations the wave completes in one second. Here, the sine wave will have a frequency of 1 Hertz, meaning it completes one cycle per second.

duration = 2;: %This line sets the duration of the signal in seconds. The entire signal, whether it's an analog or digital representation, will last for 2 seconds.

sampling_rate_analog = 1000;: %This line sets the sampling rate for the analog signal. The sampling rate defines how many samples per second are taken to represent the continuous signal. In this case, it's set to 1000 samples per second, meaning 1000 data points will be collected per second to represent the analog signal.

t_analog = linspace(0, duration, duration * sampling_rate_analog);:% This line creates a time vector (t_analog) for the analog signal using the linspace function. The time vector starts from 0, ends at the specified duration (2 seconds), and has a total of duration * sampling_rate_analog points.

This ensures that the time vector is evenly sampled at the specified rate.

analog_signal = sin(2 * pi * frequency * t_analog);: %This line generates the continuous analog sine wave. The sin function is used to create a sine wave, and the argument inside the sin function (2

* pi * frequency * t_analog) represents the angular frequency as a function of time.

figure;: %This line creates a new figure for plotting. In MATLAB, a figure is a window where plots are displayed. This ensures that the upcoming plot is displayed in a new window.

subplot(2, 1, 1);: %This line creates a subplot in the figure. The subplot function divides the figure into a grid, and this specific line creates a subplot with 2 rows and 1 column, and the current plot will be the first one. This is useful when you want to display multiple plots in the same figure.

% G2: Digital System

sampling_rate_digital = 100;: %This line sets the sampling rate for the digital system. Similar to the analog system, it defines how many samples per second will be taken to represent the digital signal. Here, it's set to 100 samples per second.

t_digital = 0:1/sampling_rate_digital:duration;: %This line creates a time vector (t_digital) for the digital signal. The vector starts from 0, increments by 1/sampling_rate_digital at each step, and ends at the specified duration. This ensures that the digital signal is sampled at the defined rate.

digital_signal = sin(2 * pi * frequency * t_digital);: %This line generates the digital signal by discretizing the analog sine wave. The sin function is used, and the argument inside the sin function (2 * pi * frequency * t_digital) %represents the angular frequency as a function of time.

subplot(2, 1, 2);: %This line creates a subplot in the figure. In this case, it's the second subplot in a 2-row, 1-column layout. The current plot will be the second one.

stem(t_digital, digital_signal, 'r', 'filled');: %This line plots the digital signal using the stem function. The 'r' specifies that the stem plot should be red, and 'filled' fills the markers.

title('Digital Signal (Discretized)');: %This sets the title for the subplot, indicating that it represents the discretized digital signal.

xlabel('Time (s)'); ylabel('Amplitude');: %These lines set the labels for the x-axis and y-axis, respectively.

hold on;: %This command holds the current plot so that the next plot can be overlaid on it.

stem(t_analog, analog_signal, 'b', 'LineWidth', 1.5, 'LineStyle', '--', 'Marker', 'none');: %This line plots the analog signal on top of the digital signal for comparison. The 'b' specifies that the stem plot should be blue, and additional formatting is applied.

hold off;: %This command releases the hold on the current plot.

Referensi

Dokumen terkait

The purpose of this study is to explore the influence of 159 audio control technology Single sound wave and different types of music on its growth, 160 The sampling rate of the