I derived this inverse fourier transform a couple months ago but never posted. I wanted to explain what these two solved math problems were and how they are useful in great detail. But I guess I will just be short and sweet. If you want a further explanation you will have to do the work.

Basically these two transforms are useful in Ultra Wide Band (UWB) communications. UWB has a very high bandwidth because it signals extremal short Gaussian pulses at a very high data rate. The two transforms I present analyze UWB Gaussian pulses in both the frequency and time domains.

Due to the short time domain of UWB, it occupies a very large frequency spectrum.

g(t)=\int_{-W}^0e^{j\frac{\pi}{2}}e^{j2\pi{f}{t}}df \int_{0}^We^{j\frac{\pi}{2}}e^{j2\pi{f}{t}}df

g(t)=\frac{e^{j\frac{\pi}{2}}e^{j2\pi{f}{t}}}{j2\pi{t}}\biggr]_{-W}^0 \frac{e^{-j\frac{\pi}{2}}e^{j2\pi{f}{t}}}{j2\pi{t}}\biggr]_{0}^W

g(t)=\frac{e^{j\frac{\pi}{2}}-e^{j\frac{\pi}{2}}e^{-j2\pi{W}{t}}}{j2\pi{f}{t}} \frac{e^{-j\frac{\pi}{2}}e^{j2\pi{W}{t}}-e^{-j\frac{\pi}{2}}}{j2\pi{f}{t}}

\frac{e^{j\frac{\pi}{2}}}{j2\pi{t}}\biggl[1-e^{-j2\pi{Wt}}\biggr]+\frac{e^{-j\frac{\pi}{2}}}{j2\pi{t}}\biggl[e^{j2\pi{Wt}}-1\biggr]

\frac{1}{2\pi{t}}\biggl[1-e^{-j2\pi{Wt}}\biggr]+\frac{-1}{2\pi{t}}\biggl[e^{j2\pi{Wt}}-1\biggr]

\frac{1}{2\pi{t}}\biggl[1-e^{-j2\pi{Wt}}-e^{j2\pi{Wt}}+1\biggr]

\frac{1}{\pi{t}}(1-\cos(2\pi{Wt}))

\frac{1}{\pi{t}}(2\sin^2(\pi{Wt})

\frac{(\pi{t}W)^2}{\pi{t}}\frac{(2\sin^2(\pi{Wt})}{(\pi{t}W)^2}

2sinc^2(tW)\pi{t}W^2

If you are like me, at some point you have tried to remove newlines from a file with SED.
I have encountered this many times, the nuance always seems to escape me the next time I need it.

The reason it can’t be done in the manner you are most likely trying (sed ’s/\n//g’ infile > outfile), is because SED operates on one line at a time, and generally ignores the newline character.

An easy way to accomplish this is to use awk, or tr:

awk '{ORS=" "; print $0}' infile > outfile
or
cat infile|tr '\n' ' '

If you are stubborn, and still want to use sed;
sed -n ':a;N;$!ba;s/\n//g;p' infile >outfile

Quadrature Phase-shift Keying (QPSK) is a widely used method of transferring digital data by changing or modulating the phase of a carrier signal. In QPSK digital data is represented by 4 points around a circle which correspond to 4 phases of the carrier signal. These points are called symbols. Figure 1 shows this mapping. Gray coding is used in this mapping so that no two adjacent symbols differ by more than 1 bit. This helps in reducing the Bit Error Rate (BER).

Grey Coded Constelation
QPSK Constellation

To model QPSK, we need:
-Input Data to transmit/modulate with carrier
-Noisy Medium to transfer the data
-Demodulation of transmitted data.
-Comparison of original signal, and the demodulated signal to calculate the Bit Error Rate (BER)

For the input signal we can use the following command:
x_signal = randint(1000,1,4);

To modulate the data against the grey coded constellation, you can use the genqammod matlab function.
y = genqammod(x_signal,constell_gray);

I then made a for loop, each iteration of the loop represents the Signal to Noise Ratio (SNR).
for SNR=0:2:10
y_noisy = awgn(y,SNR,'measured');

From the below graphs, you can see that the higher the SNR, the better the received signal.
SNR = 6
QPSK SNR = 6

SNR = 10
QPSK with SNR of 10

QPSK is simple and works fine for most applications. To increase bandwidth, you can use more than 4 symbols to represent your data. For instance, digital cable companies such as charter and Comcast, use 256-QAM. 256 QAM looks similar to the constellation above, except there are 64 symbols in each quadrant arranged in a rectangular fashion. The symbols are determined by modulating the Phase, and Amplitude of the carrier signal.

To demonstrate how effective QAM is, I modulated the original data input using 4-QAM instead of QPSK. The graph is shown below:
4-QAM
4_QAM

This can be done with a little effort. I will spare the howto as many others have done this. However, this product is so great it is worth the post to help get the word out.

The idea is simple, if your computer can play it, TVersity can transcode it to a format viewable by your 360. It actually streams to the port that windows media center runs on, so your xbox360 thinks TVersity is a pc with media center.

It took me all of 5 minutes to get this running. You can do it to:
1. Download and install TVersity - http://tversity.com/home
2. Add Directories on your PC to your TVersity library. These Directories can contain any media in any format. music, pics, and vid.
3. Open firewall for TVersity port 41952 and Forward port on router if applicable
4. In the Xbox360 Dashboard, under media –> video –> connect to TVersity.
5. Now play quicktime, divx, xvid, avi, ogg, lossless…… on your xbox360 :D

It even adds more features like the ability to connect to youtube and live TV feeds around the world. TVersity is truly a MUST have for any xbox360 owner.

I currently stream DVD quality DIVX rips over a 54mbit 802.11g to my 360. I can scrub movies very fast. I am very impressed.

Like many, I have spent the last two days hitting the refresh button on my Yahoo NCAA Bracket.

I was curious as to how many possible bracket picks there are. Being a computer guy this is a very easy question to answer. A game is binary, you either win, or you loose. There are 63 games played. (32+16+8+4+2+1 or 11111 in binary)

Anyways 2 outcomes for each 63 games is 2^63 possibilities. Thats far, far, far more than what most people would expect.
In computer terms that is over 8 million terabytes of data!

Here is a little binary math:
2^10 = 1024 == 1000 == 1k
2^30 = 1k*1k*1k ==1 gig
2^40 = 1k*1gig == 1 tb
2^50 = 1k * 1tb
2^60 = 1k * 1k * 1tb == 1 million terrabytes
2^3 = 8

8 Million Terabytes!

Spent some time on the problem for homework in my Communication Theory Course. The problem is a Fourier Transform of a damped sinusoidal wave. I plan on adding Matlab Graphs in a couple days…

Here, g(t) is the signal in the time domain. G(f) is the transform to the frequency domain. Enjoy!

g(t)=e^{-t}sin(2\pi{f_{c}}t)u(t)

G(f)=\int_{\small-\infty}^{\small\infty}e^{-t}sin(2\pi{f_{c}}t)u(t)e^{-j2\pi{f}t}dt

G(f)=\int_{\small0}^{\small\infty}e^{\small-t}\frac{e^{j2\pi{f_{c}}t}-e^{-j2\pi{f_{c}}t}}{2j}e^{-j2\pi{f}t}dt

G(f)=\frac{1}{2j}\int_{\small0}^{\small\infty}e^{j2\pi{f_{c}}t-t-j2\pi{f}t}-e^{-j2\pi{f_{c}}t-t-j2\pi{f}t}dt

G(f)=\frac{1}{2j}\biggl[\frac{e^{-t(-j2\pi{f_{c}}+1+j2\pi{f})}}{-j2\pi{f_{c}}+1+j2\pi{f}}\biggr]_0^{\infty}-\frac{1}{2j}\biggl[\frac{e^{-t(j2\pi{f_{c}}+1+j2\pi{f})}}{j2\pi{f_{c}}+1+j2\pi{f}}\biggr]_0^{\infty}

G(f)=\frac{1}{2j}\biggl[\frac{1}{j2\pi{f_{c}}-1-j2\pi{f}}\biggr]-\frac{1}{2j}\biggl[\frac{1}{-j2\pi{f_{c}}-1-j2\pi{f}}\biggr]

G(f)=\frac{1}{2j}\biggl[\frac{-j2\pi{f_{c}}-1-j2\pi{f}-j2\pi{f_{c}}+1+j2\pi{f}}{(j2\pi{f_{c}}-1-j2\pi{f})(-j2\pi{f_{c}}-1-j2\pi{f})}\biggr]

G(f)=\frac{1}{2j}\biggl[\frac{j4\pi{f_{c}}}{4\pi^2f_{c}^2+4\pi^2f_{c}f+1+j2\pi{f}-4\pi^2f_{c}f+j2\pi{f}-4\pi^2{f}^2}\biggr]

G(f)=\frac{2\pi{f_{c}}}{1+4\pi^2({f_{c}^2}-f^2)+j4\pi{f}}

Graph Damped sin with Frequency of 30Hz
Damped Sinusoidal Wave

Graph of Frequency Response
Damped Sinusoidal Wave Frequency Response

I get several requests for directory data in CSV format. Until openldap has a csv output option, we will use SED to save the day!

ldapsearch -h localhost -b o=mydomain,c=us uid=sbak* mail telephonenumber

dn: GID=0000001,o=mydomain,c=us
telephoneNumber: 1-734-555-0001
mail: sbak@mydomain.com

dn: GID=0000002,o=mydomain,c=us
telephoneNumber: 1-734-555-0002
mail: sbaker@mydomain.com

If we redirected the above date to a file 11.txt we can than run this command to place a comma at the end of every line:

sed -n '1h;2,$H;${g;s/\n/,/g;p}' 11.txt > 22.txt

Next we will use a simple sed to replace the double comma with a newline:

sed 's/,,/\n/g' 22.txt > 33.csv

Lets look at 33.csv to see the finished product:

sbak@fedoraCore:~ $ cat 33.csv
dn: GID=0000001,o=mydomain,c=us,telephoneNumber: 1-734-555-0001,mail: sbak@mydomain.com
dn: GID=0000002,o=mydomain,c=us,telephoneNumber: 1-734-555-0002,mail: sbaker@mydomain.com

Now you can send your managers data that they can open with excel!

Jay R. Wren has a great post on how to do this:
querying-active-directory-with-unix-ldap-tools

What Jay did not mention is how to search the Global Catalog (GC). The global catalog contains a partial replica of all objects in the forest. To find Domain Controllers that are serving as Global Catalogs you simply need to query DNS SRV Records. Global Catalog SRV Records take the following form: _ldap._tcp.gc._msdcs.MYINETDOMAIN.com
host -av _ldap._tcp.gc._msdcs.MYINETDOMAIN.com

The key to being able to query active directory from linux machines is DNS. The Host command can be used to look at DNS for AD SRV and A records. These records contain names and IPs of Active Directory Domain Controllers.

The only other information you need is the Global Catalog port: 3268
Putting this all together, you should have:
ldapsearch -xLLL -h IPofGC -p 3268 -b dc=MYINETDOMAIN,dc=com -D ME@MYINETDOMAIN.com -w passwd [filter] [attribute list]

Finally, I have created a shell script called GC.sh that behaves like “ldapsearch”

HOST=`host -av _ldap._tcp.gc._msdcs.MYINETDOMAIN |tail -3 |head -1 |awk '{print $5}'`
echo "using $HOST"
ldapsearch \-xLLL \-h $HOST \-p 3268 \-b dc\=MYINETDOMAIN,dc\=COM \-D "ME@MYINETDOMAIN.com" \-w xxxxxxxx $1 $2 $3 $4 $5 $6

$1 is the filter.
$2-6 are attributes that you wish returned
Leave $2-6 blank if you wish to return all attributes.

Ex: ./GC.sh cn=jrwren hascsharpskills hasmathskills
dn: cn=jrwren,ou=users,dc=myinetdomain,dc=com
hascsharpskills: 1
hasmathskills: 0

We recently had a baby and take a LOT of pictures. The problem is, depending on which way the stars are aligned, my wife or I will:

  1. Download pictures with the USB cable provided to her laptop
  2. Place SD card into the printer of her computer and grab them that way
  3. Or I will place the SD card into the SD card reader on my PC and grab them

The problem with this is, the pictures are scattered about over 3 machines and I never know where they are. Its was getting increasingly annoying, so I decided to sync the “My Pictures” folder on each of our three windows machines with Rsync, mount, and cron on my Fedora machine. The main idea is to Pull all three “My Pictures” folders to the linux in one central folder. And then push that central folder back out to all three machines.

Step 1:

Mount your windows machine to /mnt/directory
mount -t cifs //192.168.1.2/C$ -o username=USERNAME,password=PASSWORD /mnt/Windows_C/.

Step 2:

use Rsync to grab directory listing and grab only updated or new items.
rsync -aruvz /mnt/Windows_C/Documents\ and\ Settings/steve/My\ Documents/My\ Pictures/Addison/* /home/sbak/AddisonSync/.

Step 3:

Repeat steps 1 and 2 for all machines that you wish to sync.


Step 4:

Push the sync’d folder on the linux machine to all machines that need to be synced. To do this, you simply reverse the source and destination fields of the rsync command in step 2.
rsync -aruvz /home/sbak/AddisonSync/* /mnt/Windows_C/Documents\ and\ Settings/steve/My\ Documents/My\ Pictures/Addison/.

Step 5:
Put the above steps into a shell script. One for pull and one for push for each machine.
PullMachineA.sh:
mount -t cifs //192.168.1.2/C$ -o username=USERNAME,password=PASSWORD /mnt/Windows_C/.
rsync -aruvz /mnt/Windows_C/Documents\ and\ Settings/steve/My\ Documents/My\ Pictures/Addison/* /home/sbak/AddisonSync/.
umount /mnt/Windows_C/

PushMachineB.sh
mount -t cifs //192.168.1.2/C$ -o username=USERNAME,password=PASSWORD /mnt/Windows_C/.
rsync -aruvz /home/sbak/AddisonSync/* /mnt/Windows_C/Documents\ and\ Settings/steve/My\ Documents/My\ Pictures/Addison/.
umount /mnt/Windows_C/


Step 6:

schedule shell scripts in crontab. I scheduled mine every 6 hours.
0 0,6,12,18 * * * (/home/sbak/Syncs/pullA.sh >> /home/sbak/Syncs/logs/AddisonSync.log)
10 0,6,12,18 * * * (/home/sbak/Syncs/pullB.sh >> /home/sbak/Syncs/logs/AddisonSync.log)
20 0,6,12,18 * * * (/home/sbak/Syncs/pullC.sh >> /home/sbak/Syncs/logs/AddisonSync.log)
30 0,6,12,18 * * * (/home/sbak/Syncs/pushA.sh >> /home/sbak/Syncs/logs/AddisonSync.log)
40 0,6,12,18 * * * (/home/sbak/Syncs/pushB.sh >> /home/sbak/Syncs/logs/AddisonSync.log)
50 0,6,12,18 * * * (/home/sbak/Syncs/pushC.sh >> /home/sbak/Syncs/logs/AddisonSync.log)

Sorry for title.

For Christmas I got an Xbox360. The 360 and my wired network are at complete opposite ends of my home. There is not clean way to get cat5 to the 360. I started my research on finding a way to connect two wired networks via a wireless link. This was not easy but one thing was clear, my wrt54g v5 could not be flashed and I would need a new router anyways.

I bought a wrt54gl and put openWRT on it immediately. I then configured the unit with x-wrt which is a web GUI with many useful features to configure your router. If you are not comfortable SSHing into your router and configuring everything with vi, X-Wrt will take care of you.

I now had two routers and started playing around with them, connecting them with cat5 assigning different IPs and just trying to learn and get something meaningful accomplished.

Hours and weeks of googling never helped. I tried putting the wrt54gl in client mode and connecting to the wrt54g… nothing worked.
My big break came when I stumbled on the greatest link ever: http://www.bitsum.com/openwiking/owbase/ow.asp?WRT54G5%5FCFE
It’s a tutorial on how to flash the linksys wrt54g v5 with dd-wrt-micro. I flashed the router with ease and soon after had both routers running in AP mode with WDS enabled. My two wired networks connected by wireless link goal I started two months ago had been met!

Several new interesting issues came up when I got WDS up and running. dd-wrt on my wrtg54g V5 seemed to run much much better than openwrt on my wrt54gl. Things that I will cover soon in future posts:

  • dd-wrt vs openwrt
  • WDS is it a viable solution for the above applicaton
  • boosting xmit power of the routers, does it increase SNR of the WDS nodes?

Next Page »