WC Lab Manual
WC Lab Manual
ENGINEERING
RAJKOT
LAB MANUAL
Wireless Communication
(3171608)
SANJAYBHAI RAJGURU COLLEGE OF
ENGINEERING
CERTIFICATE
Now, from this point, there are two different ways to setup an Ad-Hoc network:
The choice of which one to use depends on your preference. The setup of the Ad-Hoc network only
needs to be performed on the first computer being configured.
Ad-Hoc Network Configuration using the Setup a Connection or Network Wizard:-
When using the wizard method, the first task to perform requires the selection of 'Set up a
new connection or network' option from the main window; this is shown in Figure 1.
At the bottom of the list shown in the window is the option to Set up a wireless ad hoc
(computer-to-computer) network. Once this option is selected the window shown in Figure 3
is displayed.
The next window shown in Figure 4 lets the user select the Network name, Security type and
Security key which will be used between the computers. It is always recommended that a
strong security option is used even when only connecting together two computers as it is
always possible for a nearby person to exploit the lack of security.
There is also an option to Save this network; when this box is selected, the Ad-Hoc wireless
network is saved in the list of available wireless networks to connect to.
Once the Add selection is selected, the window shown in Figure 8 is displayed. From this
window the option to 'Create an ad hoc network' would be used to create an ad hoc network.
Figure 10: Give your network a name and choose security options
Now, if you selected the option to Save this network when creating the Ad-Hoc network, it
will show up under Manage wireless networks as shown in Figure 12.
Figure 12: Manage wireless networks that use (Wireless Network Connection)
Regardless of whether the Save this network option was selected, the computer is going to
connect to the just created Ad-Hoc network. However, if the network was not saved, once the
computer is rebooted or if a connection is made to another wireless network then the Ad-Hoc
network will not be an available option without recreating it again.
Simply select the network and choose connect. If no wireless security was selected, then the
network will be connected; if wireless security was configured then the window shown in
Figure 15 will be displayed to allow the entry of the security key.
Once the network is connected, the network will show as connected as shown in Figure 16.
Figure 16: Connected to Wireless Ad-Hoc Network
The Ad-Hoc network is very useful when trying to connect computers together which have
wireless capabilities and no active wireless router or access point to connect them together. If
the need to network computers together in these situations happens, the Ad-Hoc option is
certainly an easy to setup option which enables these abilities.
Propagation environments have significant effects on the amplitude, phase, and shape of
propagating space-time wavefields. In some cases, you may want to simulate a system that
propagates narrowband signals through free space. If so, you can use the phased. Free
Space System object™ to model the range-dependent time delay, phase shift, Doppler shift, and
gain effects.
Consider this object as a point-to-point propagation channel. By setting object properties, you
can customize certain characteristics of the environment and the signals propagating through it,
including:
Propagation speed and sampling rate of the signal you are propagating
Signal carrier frequency
Whether the object models one-way or two-way propagation
Each time you call step on a phased. Free Space object, you specify not only the signal to
propagate, but also the location and velocity of the signal origin and destination.
You can use fspl to determine the free space path loss, in decibels, for a given distance and
wavelength.
lambda = physconst('LightSpeed')/1e9;
Solve for the two-way loss in dB using fspl. The two-way loss is twice the one-way loss.
L = 2*fspl(tgtrng,lambda)
L = 197.4635
The free space path loss in decibels is approximately 197.5 dB.
Alternatively, you can compute the loss directly from
Loss = 2*pow2db((4*pi*tgtrng/lambda)^2)
Loss = 197.4635
Construct a linear FM pulse waveform of 50 ms duration with a bandwidth of 100 kHz. Model
the range-dependent time delay and amplitude loss incurred during two-way propagation. The
pulse propagates between the transmitter located at (1000,250,10) and a target located
at (3000,750,20). The signals propagate at the speed of light.
waveform = phased.LinearFMWaveform('SweepBandwidth',1e5,...
'PulseWidth',5e-5,'OutputFormat','Pulses',...
'NumPulses',1,'SampleRate',1e6,'PRF',1e4);
signal = waveform();
channel = phased.FreeSpace('SampleRate',1e6,...
'TwoWayPropagation',true,'OperatingFrequency',1e9);
y = channel(signal,[1000; 250; 10],[3000; 750; 20],[0;0;0],[0;0;0]);
Plot the magnitude of the transmitted and received pulse to show the amplitude loss and time
delay.
t = unigrid(0,1/waveform.SampleRate,1/waveform.PRF,'[)');
subplot(2,1,1)
plot(t.*1e6,abs(signal))
title('Magnitude of Transmitted Pulse')
xlabel('Time (microseconds)')
ylabel('Magnitude')
subplot(2,1,2)
plot(t.*1e6,abs(y))
title('Magnitude of Received Pulse')
xlabel('Time (microseconds)')
ylabel('Magnitude')
The delay in the received pulse is approximately 14 μs, the expected value for a distance of 4.123
km.
1) What is Bluetooth? Explain concept of piconet and scatter net in Bluetooth.
PRACTICAL - 3
AIM: Write a MATLAB Program based on Ground Reflection (Two-ray)
Model
The Two Ray Channel models a narrowband two-ray propagation channel. A two-ray
propagation channel is the simplest type of multipath channel. You can use a two-ray channel to
simulate propagation of signals in a homogeneous, isotropic medium with a single reflecting
boundary. This type of medium has two propagation paths: a line-of-sight (direct) propagation
path from one point to another and a ray path reflected from the boundary. You can use this
System object for short-range radar and mobile communications applications where the signals
propagate along straight paths and the earth is assumed to be flat. You can also use this object for
sonar and microphone applications. For acoustic applications, you can choose the fields to be
non-polarized and adjust the propagation speed to be the speed of sound in air or water. You can
use Two Ray Channel to model propagation from several points simultaneously.
While the System object works for all frequencies, the attenuation models for atmospheric gases
and rain are valid for electromagnetic signals in the frequency range 1–1000 GHz only. The
attenuation model for fog and clouds is valid for 10–1000 GHz. Outside these frequency ranges,
the System object uses the nearest valid value.
The Two Ray Channel System object applies range-dependent time delays to the signals, and as
well as gains or losses, phase shifts, and boundary reflection loss. The System object applies
Doppler shift when either the source or destination is moving.
Signals at the channel output can be kept separate or be combined — controlled by
the Combined Rays Output property. In the separate option, both fields arrive at the destination
separately and are not combined. For the combined option, the two signals at the source
propagate separately but are coherently summed at the destination into a single quantity. This
option is convenient when the difference between the sensor or array gains in the directions of
the two paths is not significant and need not be taken into account.
Unlike the phased. Free Space System object, the Two Ray Channel System object does not
support two-way propagation.
To perform two-ray channel propagation:
Create the Two Ray Channel object and set its properties.
Call the object with arguments, as if it were a function.
Syntax
prop_sig = channel(sig,origin_pos,dest_pos,origin_vel,dest_vel)
Description
In the two-ray environment, there are two signal paths connecting every signal origin and
destination pair. For N signal origins (or N signal destinations), there are 2N number of paths.
The signals for each origin-destination pair do not have to be related. The signals along the two
paths for any single source-destination pair can also differ due to phase or amplitude differences.
You can keep the two signals at the destination separate or combined — controlled by
the Combined Rays Output property. Combined means that the signals at the source propagate
separately along the two paths but are coherently summed at the destination into a single
quantity. To use the separate option, set Combined Rays Output to false. To use
the combined option, set Combined Rays Output to true. This option is convenient when the
difference between the sensor or array gains in the directions of the two paths is not significant
and need not be taken into account.
c = physconst('LightSpeed');
fs = 1e6;
pw = 10e-6;
pri = 2*pw;
PRF = 1/pri;
fc = 100e6;
lambda = c/fc;
waveform = phased.RectangularWaveform('SampleRate',fs,'PulseWidth',pw,...
'PRF',PRF,'OutputFormat','Pulses','NumPulses',2);
wav = waveform();
n = size(wav,1);
figure;
plot((0:(n-1)),real(wav),'b.-');
xlabel('Time (samples)')
ylabel('Waveform magnitude')
Specify the Location of Source and Receiver
Place the source and receiver about 1000 meters apart horizontally and approximately 10 km
apart vertically.
pos1 = [1000;0;10000];
pos2 = [0;100;100];
vel1 = [0;0;0];
vel2 = [0;0;0];
n = size(prop_signal,1);
delay = 0:(n-1);
plot(delay,abs(prop_signal(:,1)),'g')
hold on
plot(delay,abs(prop_signal(:,2)),'r')
plot(delay,abs(prop_signal(:,1) + prop_signal(:,2)),'b')
hold off
legend('Line-of-sight','Reflected','Combined','Location','NorthWest')
xlabel('Delay (samples)')
ylabel('Signal Magnitude')
The plot shows that the delay of the reflected path signal agrees with the predicted delay. The
magnitude of the coherently combined signal is less than either of the propagated signals
indicating that there is some interference between the two signals.
1) what are HLR and VLR? Describe its functions in call routing and roaming
PRACTICAL - 4
AIM: Write a MATLAB Program based on Diffraction Model.
The amplitude of a diffracted scalar wave of frequency and wave vector magnitude can be
accurately represented by an integral over surface elements of contributions of the form
where is the value of the wavefront within the aperture, is the distance between this source point
and an observation point, and is the angle to the observation point from the normal to the
incident wave front. The term proportional to (the dominant part at large distances) is halved at
and vanishes in the backwards direction (). If application, we have and the far field result
expresses Huygens’s principle.
This script calculates the observed intensity distribution for a plane wave normally incident upon
a plane containing a rectangular aperture and observed striking a parallel viewing plane at some
distance. The integral for the amplitude is a harmonic function of time and we set t=0. The real
and imaginary parts differ only in phase. The intensity is proportional to the time average of the
square of either and hence to the square of the absolute value of the complex quantity.
func = @(x,y,xp,yp,zp)(exp(i*k.*((x-xp).^2+(y-yp).^2+(z-zp).^2).^(1/2))...
./((x-xp).^2+(y-yp).^2+(z-zp).^2).^(1/2))...
.*(1*i*k+(zp./((x-xp).^2+(y-yp).^2+(z-zp).^2).^(1/2)).*(1*i*k+((x-xp).^2+(y-yp).^2+(z-
zp).^2).^(-1/2)));
tic
for yp=yprange
Initialize a column vector to contain amplitude values for a column of screen position values.
q=[];
Loop over x positions on the viewing screen.
for xp=xprange
Create a function to calculate the total amplitude at the viewing position for the given field point.
%fun = @(x,y)exp(i*k.*((x-xp).^2+(y-yp).^2+(z-zp).^2).^(1/2))./((x-xp).^2+(y-yp).^2+(z-
zp).^2).^(1/2);
fun=@(x,y)func(x,y,xp,yp,zp);
Integrate the function over the slit and aggregate the values in the column vector.
q=[q ;integral2(fun,xmin,xmax,ymin,ymax,'Method','tiled','RelTol',RelTol)];
end
Aggregate column vectors.
Q=[Q q];
end
toc
For an aperture wide in y, at large distance, the intensity approximates the shape of the aperture
but is still modulated by diffraction fringes.
The main method creates a thread to wait for connection from client and handle the signal.
package com.luugiathuy.apps.remotebluetooth;
import javax.bluetooth.DiscoveryAgent;
import javax.bluetooth.LocalDevice;
import javax.bluetooth.UUID;
import javax.microedition.io.Connector;
import javax.microedition.io.StreamConnection;
import javax.microedition.io.StreamConnectionNotifier;
StreamConnectionNotifier notifier;
StreamConnection connection = null;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import java.io.InputStream;
import javax.microedition.io.StreamConnection;
public class ProcessConnectionThread implements Runnable {
private StreamConnection mConnection;
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Process the command from client
* @param command the command code
*/
case KEY_RIGHT:
robot.keyPress(KeyEvent.VK_RIGHT);
System.out.println("Right");
break;
case KEY_LEFT:
robot.keyPress(KeyEvent.VK_LEFT);
System.out.println("Left");
break;
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
REMOTE CONTROL CLIENT (Android)
package com.example.sairamkrishna.myapplication;
import android.net.wifi.WifiManager
;
import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
enableButton=(Button)findViewById(R.id.button1);
disableButton=(Button)findViewById(R.id.button2);
enableButton.setOnClickListener(new OnClickListener(){
public void onClick(View v){
WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
wifi.setWifiEnabled(true);
}
});
disableButton.setOnClickListener(new OnClickListener(){
public void onClick(View v){
WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
wifi.setWifiEnabled(false);
}
});
}
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:src="@drawable/abc"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="76dp"
android:text="Enable Wifi"
android:layout_centerVertical="true"
android:layout_alignEnd="@+id/imageView" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Disable Wifi"
android:layout_marginBottom="93dp"
android:layout_alignParentBottom="true"
android:layout_alignStart="@+id/imageView" />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sairamkrishna.myapplication" >
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
1) Discuss Applications of mobile computing
PRACTICAL - 7
AIM: Write a program to find hamming distance. For example Hamming distance
d(v1,v2)=3 if v1=011011,v2=110001.
///
// Calculating the Hamming Distance for two strings requires the string to be of the same
length.
///
public int getHammingDistance()
{
if (compOne.length() != compTwo.length())
{
return -1;
}
int counter = 0;
return counter;
}
///
// Hamming distance works best with binary comparisons, this function takes a string arrary
of binary
// values and returns the minimum distance value
///
public int minDistance(String[] numbers)
{
int minDistance = Integer.MAX_VALUE;
if (checkConstraints(numbers))
{
for (int i = 1; i < numbers.length; i++)
{
int counter = 0;
for (int j = 1; j <= numbers[i].length(); j++)
{
if (numbers[i-1].charAt(j-1) != numbers[i].charAt(j-1))
{
counter++;
}
}
return minDistance;
}
return true;
}
}
1)Explain functional architecture of GSM system. What are the possible handover
scenarios in GSM?
2) Explain RFID and WiMAX.