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.