Thursday, February 24, 2011

MEEP colormap for Matlab

I have been thinking of using the colormap used in the MEEP software (an open source FDTD code) as a nice alternative to the classical Matlab colormap. Here is the short Matlab code to generate it and the resulting images:

mincolor    = [1 0 0]; % red
mediancolor = [1 1 1]; % white   
maxcolor    = [0 0 1]; % blue      

ColorMapSize = 4;
int1 = zeros(ColorMapSize,3); 
int2 = zeros(ColorMapSize,3);
for k=1:3
    int1(:,k) = linspace(mincolor(k), mediancolor(k), ColorMapSize);
    int2(:,k) = linspace(mediancolor(k), maxcolor(k), ColorMapSize);
end
meep = [int1(1:end-1,:); int2];

colormap(meep); 
colorbar
Classical Matlab colormap (jet)
MEEP colormap with ColorMapSize 64
MEEP colormap with ColorMapSize 16
MEEP colormap with ColorMapSize 4

*Images are snapshots from the FDTD simulation of a dish antenna.

caxis and colorbar in Matlab


If colorbar is used before the caxis, the colorbars show the original image limits. Thus, colorbars are not accurate
When the colorbar is used after caxis. This time the colorbars are accurate.

When using caxis with pcolor in Matlab, colorbar does not update if it is defined before caxis is called. The remedy is basically use colorbar whenever a new axis limit is defined by caxis. The sample code given in Matlab's manual is modified as follows to handle the issue of interest.


figure (1); clf; 
load cape
colormap(map)
subplot(2,2,1)
image(X,'CDataMapping','scaled');  
axis image
title('Caxis = [1 192]'); colorbar;
subplot(2,2,2)
image(X,'CDataMapping','scaled')
axis image
title('Caxis = [20 192]');  
caxis([20 192]); 
colorbar;  % Should be introduced after the caxis is employed
subplot(2,2,3)
image(X,'CDataMapping','scaled')
axis image
title('Caxis = [50 192]');  
caxis([50 192]); 
colorbar;
subplot(2,2,4)
image(X,'CDataMapping','scaled')
axis image
title('Caxis = [100 192]');  
caxis([100 192]); colorbar;

Sunday, February 20, 2011

Right Hand Circular Polarization (RHCP) Animation

Radiation from a Circularly Tapered Dielectric Waveguide



Finite-difference time-domain (FDTD) simulation of a dielectric waveguide terminated with a circular tapering. The dielectric permittivity of the waveguide is 2.2 and air is the ambient medium. Such antennas are developed for ground penetrating technology (GPR) technology to reduce the footprint of the antenna.

Also see below:
Oblique Plane Wave Reflection From Half Space
Radiation from a Circularly Tapered Dielectric Waveguide
Right Hand Circular Polarization (RHCP) Animation
Linear Polarization Animation
Left Hand Elliptical Polarization (LHEP) Animation
Standing Wave Pattern (SWR) Animation
Electromagnetic Propagation of UWB Short Pulse in Random Medium 
Half Wavelength Dipole Antenna Radiation 
Dipole Antenna Radiation 
Dish Antenna Animation (Parabolic reflector) 
FDTD Simulation of a Half Convex Lens

Sony GPS-CS3KA Review (Geo-tagging) and Performance in the Airplane


First few minutes of a flight from Long Beach, CA to Portland, OR
Final moments of the same flight while landing to PDX
A successful logging from Paris to Istanbul

I have been using Sony GPS-CS3KA over a year and so far I have been satisfied with it although I wish some of its features were better. One point I would like to note is that it is possible to log your flight routes (of course as well as photos taken along the flight) with this GPS.  It is pretty exciting to see the actual roots taken while flying between cities. However, in my experience, one should sit by the window for satisfactory performance. If the GPS unit is not close to the window, then it is difficult to get connected to the satellites which unfornutaly means no logging. Also, one should make sure that battery employed within the GPS unit is full before the flights (especially the long ones). While airborne, several times I had difficulties in reconnecting to the satellites after I lost connection due to battery change or any other reason.
Flight from Istanbul to Antalya.

For example, in a particular flight from Istanbul (SBH) to Antalya, it was not possible to grab the signal even during the taxiing. However, approximately 20 minutes after getting airborne, the GPS unit was able to connect to the satellites and the resulting route is given in the accompanying figure on the left.

Also, check the below link for two additional international flight:
Geo-tagging two International Flights on April 24, 2010

Saturday, February 19, 2011

Dipole Antenna Radiation



Finite-difference time-domain (FDTD) simulation of a 2 wavelengths long dipole antenna at 400 MHz in free space. The radiation pattern is very different than that of the traditional half-wavelength dipole antenna. Nulls in the broadside and endpoints are clearly visible

Dish Antenna Animation (Parabolic reflector)

Dish Antenna Animation (Parabolic reflector)



Finite-difference time-domain (FDTD) simulation of a parabolic reflector antenna in the transmitting phase. Reflector antennas are frequency-independent antennas and they are highly directive. As long as the source is located at the focal point, the reflected field travels in the broadside direction. In this simulation, two short pulses - first one at central frequency of 100 MHz and the other at 200 MHz are fired from the focal point (VHF regime). f/D (focal length/diameter) ratio is 0.257.

Normally, the feed antenna is also chosen to be directive, but for the purpose of illustration, we have chosen a point source as the feed antenna.

Below, one can see several microwave link stations in the form of dish antennas (Photo captured in Mount Hood in Oregon around 7000 ft).



Also see below for other simulations:

Half Wavelength Dipole Antenna Radiation
Oblique Plane Wave Reflection From Half Space
Radiation from a Circularly Tapered Dielectric Waveguide
Right Hand Circular Polarization (RHCP) Animation
Linear Polarization Animation
Left Hand Elliptical Polarization (LHEP) Animation
Standing Wave Pattern (SWR) Animation
Electromagnetic Propagation of UWB Short Pulse in Random Medium

Backspace not deleting to the left in Vi(m)

While working with vi(m), backspace may not perform as intended. It may print ^? and progress to the right. To alleviate that problem, simply add the following code into ~/.vimrc file:
:set t_kb=^?
:fixdel
:set bs=2 "Fix Backspace in VIM

Monday, February 01, 2010

Driving in Sri Lanka

During a recent trip to Sri Lanka, I traveled with a friend and rented a car. The country has a stunning nature. The people are very friendly. However, the traffic and roads were very bad in many parts of the country. There was only a small section between Colombo and Dambulla that the road was paved nicely. I recorded the following video from the road.

Monday, January 30, 2006

Travnik ve Günlüğü

Bosna deyince meraklıların ya da ilgilenenlerin dışında akla pek gelmeyen bir şehir Travnik... Oysa tarihde bir zamanlar "Bosnanın İstanbulu" lakabını bile almış köklü ve şirin bir şehir.... Osmanlı zamanında Bosna eyalatinin başkenti olmasından ötürü tarihsel anlamda çok zengin aynı zamanda bir o kadar da çekici bir doğa güzelliğine sahip... Saraybosnadan Zagreb yönünde 1.5 saatlik mesafede olup yandaki resimde görüldüğü gibi ani bir virajdan sonra ortaya çıkıveren şimdinin ne yazık ki biraz unutulmuş şehri... Bu şehir ile tanışmam şehre büyük sevgi duyan Ivo Andriç’in Drina Köprüsünün dışındaki çalışmalarını da merak edip Travnik Günlüğü adlı kitabını bulmamla başladı. 1807 yılında Fransız konsolosunun şehre ilk defa gelmesinin ve de onu bir yıl sonra da Avusturya konsolosunun takip etmesinin hem müslüman halkın hem de gayrı-müslümlerin gözünden anlatıldığı kitapta zamanın tarihsel gerçekleri (Napolyonun seferleri, Sultan III. Selimin tahttan indirilmesi gibi) ve çesitli insan portreleri kısa hikayelerle birbirine bağlanıp esas kitabı oluşturuyor. Bir nevi, Balkanların o devirden kalma bir fotoğrafıymış diyebileceğimiz bir kitap... Meraklısı için kesinlikle ilgi çekici ve de (biraz da ilgili tarihsel konular okunduktan sonra) öğretici bir kitap...

Kitabın yanısıra biraz da şehrin şu andaki halinden bahsetmek istiyorum. Kitabın da etkisiyle bu yaz orayı görme fırsatım oldu ve ilk olarak söyleyebileceğim
eğer bir gün yolunuz Saraybosnaya düşecek olursa Travnik’i görmeden gitmeyin…Hem yakınlık hem de ulaşımın rahat olması günübirlik bir geziyle şehrin hemen hemen her yerini görme imkanı verecektir. Ha bu arada Saraybosna ya da Mostarda alacağınız hediyeliklerin yarı fiyatına satıldığını göreceginiz için buraya uğramadan hediyelik almayın…Şimdi gelelim gezilecek yerlere… Tabi ki öncelikle tarihi kaleye çıkıp şehri tepeden izlemek şart... Etrafta bolca bulunan derelerin şırıltısını dinlemek için bile kaleye çıkmaya değer.. Tabi bir de hemen çıkışın başındaki kahvelerde Boşnak kahvesinin de zevki bir başka… Kaleden bakmaya doyduktan sonra yavaş yavaş şehrin içinde gezintiye çıktığınızda eski camileri ve de saat kulelerini göreceksiniz. Sakın şasırmayın kendinizi Üsküdardaymış gibi hissedebilirsiniz. Ama arka plandaki dik ve yeşil dağlar buranın farklı olduğunu hissettirecektir. Ayrıca meraklıysanız pazarında mücahitlerle tanışıp üzümlerini yiyebilirsiniz. Bosnanın diğer bölgelerinde olduğu gibi Travnikde de bir çok yeni mezar savaşı hemen hatırlatıyor ve insanı kederlendiriyor. Camilerden özellikle Renkli Cami olarak da bilinen Süleymaniye Camisi altındaki bezistanlarla birlikte görülmeye değer. Yine meraklısı için Ivo Andriç’in doğduğu ev olan ama simdi hem müze hem de restoran olarak kullanılan yerde güzel bir yemek de yenebilir. Bunların dışında turistik bir kent olmamasından ötürü ingilizce konuşacak insan bulması zor olsa da insanları, hayatlarını ve de yaşam tarzlarını daha yakından tanıma imkanını bulabiliyorsunuz.
Kitapdan bir alıntı:
- Travnik Çarşısının sonunda, gürül gürül akan serin Sumeç Suyunun alt yanında, hangi devirden kaldığı iyice bilinmeyen “Lütfiyanın Kahvesi” adlı küçük bir yer vardır. Buranın ilk sahibi Lütfiyayı, kasabasının en yaşlıları bile hatırlamıyorlar. Bu Lütfiya, Travnikin dört bir yanına serpilmiş olan mezarlıklardan birinde son uykusunda yatalı yüzyılı aşmış bulunmasına rağmen, herkes kahvesini içmek için Lütfiyaya gitmekte, birçok sultanların, vezirlerin, beylerin adları unutulduğu halde, onun adı anılmakta ve dillerde dolaşmaktadır.