Skip to main content

Posts

Showing posts from October, 2014

NS 2 - Tutorial for beginners 2

NS2 program for simulation of TCP packets in a network set ns [new Simulator] set nf [open out.nam w] $ns namtrace-all $nf set nt [open out.tr w] $ns trace-all $nt proc finish {} {         global ns nf         $ns flush-trace         close $nf         exec nam out.nam &         exit 0         } set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node] $ns duplex-link $n0 $n1 10Mb 10ms DropTail $ns duplex-link $n1 $n2 1Mb 10ms DropTail $ns duplex-link $n3 $n1 10Mb 10ms DropTail $ns duplex-link-op $n0 $n1 orient right-down $ns duplex-link-op $n1 $n2 orient right $ns duplex-link-op $n3 $n1 orient right-up set tcp [new Agent/TCP] $ns attach-agent $n0 $tcp set ftp [new Application/FTP] #$ftp set packet_size_ 4.5Mb $ftp set interval_ 0.05 $ftp attach-agent $tcp set sink [new Agent/TCPSink] $ns attach-agent $n2 $sink $ns connect $tcp $sink $ns at 0.3 "$ftp start" $ns at 3.0 "finish" $ns run NS2

NS 2 - Tutorial for beginners 1

Explanation for a Simple Script Step 1: To start we have to set a few variables like simulator object, trace file and object, nam file and object:   set ns [ new Simulator ] This would set the simulator with the simulator object which is to be accessed in the script. Step 2:  Then, to set the nam (network animation) file with that 'ns' object and associate with it: set nf [ open out.nam w ] $ns namtrace-all $nf set tr [ open out.tr w ] $ns trace - all $tr This would set the trace file and would connect to the simulator. The trace file is required to analyze the various packets which are send, received type of application used etc. Step 3:  Now the nodes could be set as many as you want, for loop could be used if many nodes are to be made. set n0 [ $ns node ] Step 4:  Creating connection for the various nodes with each other with the band width and rate. $ns duplex-link $n0 $n1 10 Mb 10 ms DropTail Step 5:  The nodes could be given with various orientatio

Analog Communications lab MATLAB Programs

%% Amplitude Modulation And Demodulation % Name: % % R.No: %% closing and clearing commands close all clear all clc %% Initialization fs=8000; % sampling frequency fm=20; % message signal frequency fc=500; % carrier signal frequency t=[0:.1*fs]/fs; % time index %% Message signal Generation Am=1; % message signal amplitude m=Am*cos(2*pi*fm*t); % message signal subplot(4,3,1:3); plot(t,m); xlabel('time-->'), ylabel('amplitude') title('Modulating or Message signal(fm=20Hz)'); %% Carrier signal Generation Ac=1; % carrier signal amplitude c=Ac*cos(2*pi*fc*t); % carrier signal subplot(4,3,4:6); plot(t,c); xlabel('time-->'), ylabel('amplitude') title('Carrier signal(fc=500Hz)'); %% Under Modulation ka=0.5; % modulation sensitivity u=ka*Am; % modulation Index s1=Ac*(1+u*cos(2*pi*fm*t)).*cos(2*pi*fc*t);%AM subplot(4,3,7); plot(t,s1); xlabel('time-->'), ylabel('amplitude') title('Under

List of Websites to get free e-books

Here follows the list of websites to download e-books for free. 1. www.bookfi.org 2. www.bookzz.org  These two websites offer 4 to 5 free downloads per day. Best advantage is that we need not go for any sign-in process or clicking on an advertisement. 3. http://manybooks.net      In this website, apart from downloading in pdf format, one can download in many other e-book formats. 4. www.ebookee.org 5. www.bookboon.com 6. www.gutenberg.org 7. www.books123.me   8. www.brupt.com This website provides file in word (.doc), powerpoint (.ppt) and pdf file formats. 9. www.pdfoxy.com This website provides books in pdf format, but we should wait for 12-15 seconds and enter a Captcha code. But no need to sign-in. 10. www.docstoc.com This is another decent website of downloading ebooks in .pdf format, with no advertisement and no signing in. 11. www.freecomputerbooks.com This is one of the best websites for downloading technical and professional certification related

MATLAB tutorial for Begineers Part 3

click here for Part 2                      click here for Part 4 Working With MATLAB Type the following following commands in the Command Window, and observe(verify) their corresponding results  12 ans =     12 % commenting operator in matlab %12 a=23 a =     23 a=23; %; is a output suppressor operator who Your variables are: a    ans whos   Name      Size            Bytes  Class     Attributes   a         1x1                 8  double               ans       1x1                 8  double             who ---- This command lists the variables in workspace. whos---- This command details the variables in workspace. 12+23 ans =     35 12-23 ans =    -11 mul=12*23 mul =    276 div=12/23; %  ; is the output suppressing operator who Your variables are: a    ans  div  mul div div =     0.5217 1/2 ans =     0.5000 2/1 ans =      2 1/2 ans =     0.5000 1\2 ans =      2 %   \ is the inverted divis

MATLAB tutorial for Begineers Part 2

click here for Part 1                        click here for Part 3 1. How to open Matlab     Method1: click on matlab shortcut in start menu or on desktop     Method2: for windows os ::::Press windows+R--->type cmd--->type "matlab"              for linux os:::::::go to terminal/Konsole--->type "matlab" Note: It is recommended not to do any action, atleast-for-a-vial, while opening MATLAB because Matlab consumes more RAM while invoking.

MATLAB tutorial for Begineers Part 1

MATLAB is abbreviation for MATrix LABoratory. MATLAB is an integrated development environment and computer language that enables users to perform computationally intensive tasks.  The software is used for numerical computation tasks, visualization, and mathematical programming. For more details, see http://www.mathworks.com/products/matlab . Latest release of MATLAB is R2014a. As the name emphasis, MATLAB considers every variable/value in terms of matrices. MatLab vs c: MatLab is not a programming language, but it is a scripting language. In simple English, you use English-like commands in the MatLab program; whereas corresponding c program will run in the background. So, MatLab program is slower than c program; but is more flexible and lightweight than the former.  The latest MATLAB constitutes FOUR platforms, within its environment. 1. M-file/Script file platform 2. Simulink 3. GUIDE- Graphical User Interface IDE(Integrated Development  Envinirment) 4. Matlab