Monday 17 February 2014


FIR Filter coefficients using Excel Vba

We use different platforms to generate FIR and IIR coefficients. I tried to generate FIR filter coefficients using Excel. Low pass, High pass, Band pass, Band stop filters are implemented.

Why excel?
I choose excel for it's simple advantage, transparency. We can view each and every value and use them further easily. Understanding is better when we implement in Excel, and excel is also widely used as a professional tool in companies.

What is Excel vba?
Excel Vba is Excel with visual basic application within it. It helps to implement complicated formulas using visual basic and it's also very easy to learn. Its extension is .xlsm

Click below link to download Excel file.

Download excel file
Outlook of the Excel file














Download the .pdf file from below link showing how to use it.
How to use it.

FIR- finite impulse response
IIR - Infinite impulse response

To have better knowledge on digital signal processing, check out http://www.dsprelated.com/

Some interesting websites for Excel vba reference are,
http://www.excel-easy.com,
http://excelvbatutor.com/vba_tutorial.html
http://chandoo.org/wp/excel-vba/

I worked with IIR filter too. For any quiries comment.

Wednesday 5 February 2014

Generate Results in NS using C++:

Generating results through C++ coding:
To extract results through C++ coding in NS, you need to know the architecture of C++ and Tcl and how they are linked. If you are not advanced user, If you are working only with Tcl scripting then you are not advised to use this.

Let us take a simple C++ code to extract value of delay.

Let us take constant delay between nodes.
If number of nodes and delay is given as input, then to calculate total delay, program in C++ is

// test.cc
#include <cstdio>
#include <cstdlib>
using namespace std;
int main(int argc, char* argv[]){
 (void) argc;
float delay = 0;
del = atof(argv[1]);
int i, num_nodes = atoi(argv[2]);
for(i = 1; i <num_nodes; i++)
delay += del;
printf("Overall Packet Delay is %f seconds, where del = %f,num_nodes =%d\n",delay,d_i,num_nodes);
}

Download file here here

From the c++  file, create executable file and run it.
i.e..,
 >> g++ test.cc -o test
>> test 2 20

We get following output from terminal.
>>Overall Packet Delay is 38.000000 seconds, where del = 2.000000,num_nodes = 20.

Here we didn't call Tcl file for simplicity. Even if Tcl is linked, we do same process, but we call the variables which contain required results.

If you want results like, throughput, delay, energy lost, then all you need to do is to implement the formula in the code and request for output. Bottom line is not to try this if you are new to network simulator.

Thursday 23 January 2014

Installing NS2:


In ubuntu, there are two ways of installing NS2.

First to to download ns-allinone2.35 or the latest version at http://sourceforge.net. Direct link to
NS-2.35 is http://sourceforge.net/projects/nsnam/.

Extract the downloaded file into a folder and go to .../ns-allinone-2.35/ns-2.35/allinone folder, in which "install" file will be there. Double click it and run in terminal.
Terminal is opened in ubuntu by cntr+alt+t
Second way is to open terminal and type:

sudo apt-get install ns2
sudo apt-get install nam

sudo apt-get install xgraph

After this type ns in your Terminal, if you don't end up with a error command then you are ready to have fun with NS2.

The installation is enough for basic simulation, but for advanced simulation, we need to install C++, using sudo apt-get install g++ command in terminal.

In windows, NS2 is used using Cygwin.

To install, download ns-allinone-2.35 or latest version as discussed and go to  ../ns-allinone-2.35/ns-2.35/allinone where INSTALL.WIN32 is present. Install it in cmd window.

Network Simulator:(NS-2 and NS-3)

Simulating live networks is never been this easy. Now we can know peek inside the network to know about it just with the help of your system. Network simulator was developed with same idea I guess.
First two of its versions, i.e.. NS and NS2 are bit successful in terms of simulating a network, but are failure when it comes to speed and complexity. Their complexity is mainly because of their double layer architecture using Tcl and C++ as outer and inner layers respectively. These two are linked with Tclcl class. Too much Technical I guess, :P. To know more about them, I recommend you to go through http://www.isi.edu/nsnam/ns/ and http://www.nsnam.org. It has tutorials and everything you want to know about Network simulators. Some tutorials may be confusing or not elaborate enough, but you will get a fair outer idea about network simulators. Whatever the reason may be NS and NS2 are slow. NS3 was able to overcome this. When we look at their names, we may think they are just developments from one to another, but Surprisingly, NS3 is not even similar to previous versions. In NS3 coding is solely done by C++, optionally by Python. If you are new to this, I prefer you to start with NS3. Everything we talked about is open source. So your contribution may matter.

Links you may be interested in

Installing NS2

Installing NS3