Saturday, March 29, 2014

Mount St. Helens Hike (~8287 ft)

Mount St. Helens Hike



This was my second attempt to hike up to the Mount St. Helen's peak which is at 2526 m (8287 ft). Almost exactly 1 year after the first ascent, this time our group was only 3 people which was a big reduction compared to last year's 8 people. Similar to our group, the parking lot at Marble Snow Park also had much less cars/campers compared to last year. For the record, the starting altitude was 886 m, so roughly 1500 m was ahead of us.

Being a smaller group, we were faster to pack and start the hike in the morning. It was 6.40 am when we were in the trail. After two hours clouds started to come over the St. Helens but later on they were completely gone. It took almost 6 hours to reach the top, the view was gorgeous. The smoke from the volcano was on. The view of Mount Rainier and Mount Adams was great. Here are some snapshots from the top:







Tuesday, February 18, 2014

What happens if the Source is Inside the PML region in FDTD simulations?

In most of the FDTD simulations, perfectly matched layers play an indispensable role by their ability to absorb the incoming waves to mimic free space propagation. Triggering effect for this animation is the simple curiosity of what would happen if a point source was embedded in the PML rather than the inner domain.

To illustrate this, we utilized the uniaxial PML (UPML) formulation in a 2D FDTD scenario in homogeneous medium. We present three parallel simulations in which the point sources are located (left) deep inside the PML, (middle) slightly inside the PML and (right) outside but close to the PML. As can be observed, the PML performs great in eliminating portions of the wave impinging normal (or close to the normal) to the PML surface. But for high oblique incidences, the decaying of the wave is not completely satisfied.

For the leftmost case where the source is deeply embedded in the PML, the wave cannot propagate in the -x and +x directions and quickly decay in both directions. However, along the -/+ y directions, the PML acts as a waveguide. Thanks to the upper and lower PML regions, the wave inside the PML continues to decay along the -/+ y directions.

Total Field / Scattered Field (TF/SF) Implementation in FDTD



Here, the plane wave excitation using the total field / scattered field (TF/SF) formulation in finite-difference time-domain (FDTD) algorithm is demonstrated. The interface between the "total" and "scattered" field regions is shown using the square box. The plane wave polarized in the -z direction (with respect to screen surface) is injected into the medium along the -y direction and then the scattering phenomena from two different scatterers (one metallic triangular wedge and another circular dielectric scatterer) are animated. The reflected wavefronts from the scatterers can explicitly be observed in the scattered field regions, whereas total field is observed within the box.




Keywords: Scattering from prism, 三角柱, Prisme triangulaire, 삼각기둥,முப்பட்டகம், Триъгълна призма

Saturday, February 15, 2014

Group Velocity / Phase Velocity Animation - Case 2: Zero Group Velocity


In this second video of the series, we demonstrate the case where the group velocity is zero while the phase velocity is positive number. The individual wave components comprising the total wave are first shown at the top along with a corresponding "dot" representing the phase velocity of each component.

In the bottom figure, we have the resulting wave that travels along the +x direction with a positive phase velocity but the group velocity remains to be zero. The wave packet envelope is shown in magenta color in dashed lines.

For the other videos in the series, check the below links:
1) Group Velocity larger than Phase Velocity: https://www.youtube.com/watch?v=tlM9vq-bepA


Групповая скорость, Gruppengeschwindigkeit, Voortplantingssnelheid, Velocidad de grupo, Grupa rapido, Vitesse de groupe, Velocità di gruppo, 군속도, מהירות חבורה, ჯგუფური სიჩქარე, 群速度, Gruppefart, Prędkość grupowa, Групова швидкість, 群速度, Vận tốc nhóm, Grupphastighet, Grupinis greitis, Phasengeschwindigkeit, Velocidad de fase, 相速度, Vitesse d'une onde, Velocità di fase, Фазовая скорость, 位相速度

Sunday, February 02, 2014

Fast Fourier Transform (FFT) Animation using Matlab



We show the progress of Fast Fourier Transform (FFT) of a time-domain signal as it changes in time. Matlab's fft() function is used for illustration, hence it should be noted that the function is assumed to be periodic. The number of FFT point is assumed to be same as the time domain signal to prevent zero padding when the full domain is filled. In the beginning a sinusoidal signal at 50 Hertz (1*sin(2pi*50*t)) starts to develop and slowly fills the full domain. Then, another sinusoidal signal at a higher amplitude and 100 Hertz (1.5*sin(2pi*100*t)) is added to this signal. Later, a third sinusoidal signal at 200 Hz replaces the 100 Hz one. Following this, a DC component (0 Hz) is inserted and finally, the DC component is removed. At each stage, the the development of frequency components can clearly be observed. In the frequency spectrum, first a 50Hz component starts to build up along with lower and higher frequencies. The reason for wider spectrum is the fact that sinusoidal signal fills the domain within an increasing time window (hence introduction of sinc components). Once the full domain is filled with the sinusoidal, then only 50 Hz component remains due to the fact that the signal assumes to be periodic in Matlab fft function.

Wednesday, January 01, 2014

How to change the default background color for Matlab figure?

One of the signatures of Matlab is the grayish background color it uses for its figures unless it is changed intentionally. In conference presentations or posters, one can easily detect Matlab outputs thanks to this color. For those who want to change this color right from the startup can do so by editing the default settings of Matlab. To access the default settings, type get(0,'Default') in the Matlab command line. Then, it will display all the default settings. This is how my settings are:

get(0,'Default')

ans = 

          defaultFigurePosition: [680 678 560 420]
               defaultTextColor: [0 0 0]
              defaultAxesXColor: [0 0 0]
              defaultAxesYColor: [0 0 0]
              defaultAxesZColor: [0 0 0]
          defaultPatchFaceColor: [0 0 0]
          defaultPatchEdgeColor: [0 0 0]
               defaultLineColor: [0 0 0]
    defaultFigureInvertHardcopy: 'on'
             defaultFigureColor: [0.8000 0.8000 0.8000]
               defaultAxesColor: [1 1 1]
          defaultAxesColorOrder: [7x3 double]
          defaultFigureColormap: [64x3 double]
        defaultSurfaceEdgeColor: [0 0 0]

For our particular target of changing the default figure background, one can simply change the defaultFigureColor attribute to any desired color, e.g. to white, as follows:
set(0,'defaultFigureColor',[1 1 1])
Similarly, to black as follows:

set(0,'defaultFigureColor',[0 0 0])
And here is how the outputs look when any figure is opened after the change in the default setting.

With default background color
Modified background color: White

Modified background color: Black

Tuesday, December 24, 2013

PEPEÇURA - Kara Üzüm Muhallebisi


Pepeçura'nın en son hali
Bugüne kadar internet sayesinde farklı şehirlerde (taşınmaktan dolayı) geride bıraktığım bir çok çocukluk arkadaşıma ulaşabilmiş ve her birinde de farklı heyecanlar yaşamıştım. Geçenlerde çocukluk arkadaşlarını bulmanın heyecanını arattırmayan bir başka olay daha yaşadım. Bu olayın kahramanı ise Karadeniz bölgesi dışında çok da bilinmeyen kara üzümden yapılan Pepeçura muhallebisiydi. İnternette gezerken şans eseri  karşıma çıkınca bir anda çocukluk yıllarıma geri döndürdü beni. Çocukken neredeyse her yaz Çengelköy'e Anneannemlere giderdik, hem o hem de etrafdaki diğer Laz akrabaların etkisiyle sanki "Little Arhavi"ye gitmiş gibi olurduk. Etrafımızda bu kadar çok Laz'ın olması sayesinde Laz mutfağından farklı yiyecekleri tadma imkanimiz olurdu (Bunlardan en önemlilerinden olan Kapça Mçkudi yani Hamsili Pilavı burada daha önce anlatmıştım). İşte Pepeçura'yı da arada sırada Anneannem bizler için yapardı. Kendine özgü bordo rengi ile ister istemez Trabzonspor'u (ve doğal uzantısı olarak hamsiyi) hatırlatan bu muhallebinin önce kokusu sonra da tadı insanı kendisine bağlardı. Tabi o zaman çocukluktan ötürü, bu nedir, nasıl yapılır gibi sorularla ilgilenmez, sadece tüketmeye odaklanırdık. Zamanla Anneannem de yapmaz olunca, etrafta baska yapan da olmayinca, yavaş yavaş unuttuk gitti bu muhallebiyi. Ta ki tekrar resmini internette görene kadar. Sanki eski bir çocukluk arkadaşımı daha bulmuş gibi sevindim. Ama ufak bir sorun vardı, sadece resmini görmek yetmiyor, bir kere daha tadına bakmak gerekiyordu. Eşime, çocuklarıma, arkadaşlarıma bakın böyle bir muhteşem bir tad var demek istiyordum.


Madem Anneannemden binlerce kilometre uzaktaydım, bu muhallebiyi kendim yapmak dışında bir seçeneğim yoktu. Eşimin de yardımıyla internette kısa bir araştırma sonucu çeşitli tariflerine ulaştık. Okuduğumuz tarifleri burada elimizdeki malzemelere göre ayarlayıp yapmaya başladık. Sonuç olarak bence (en azından aklımda kaldığı kadarıyla) hem tad hem de görüntü olarak çok iyi bir sonuç çıkardık. Hem kendi arşivim, hem çocuklarım hem de meraklıları için bizim deneyip iyi sonuç verdiğini düşündüğümüz tarifi burada paylaşmak istiyorum. 
Muhallebinin adı Lazca'da Pepeçura olarak geçiyor. Bazı sitelerde kara üzüm hatta Karadeniz üzümü muhallebisi olarak da geçiyor. İsminden de anlaşılacağı gibi malzeme olarak öncelikle kokulu kara üzüm gerekiyor. Türkiye piyasasında Karadeniz üzümü olarak satılıp satılmadığından emin değilim. Burada ise marketlerde sıkça bulunan kırmızı California ya da Şili üzümleri en iyi seçenekler. Biz  bu sefer için 3 poundluk (yaklaşık 1.5 kilo)  paketlerde satılan California üzümü kullandık. Üzümleri yıkadıktan sonra bir bardak su ile birlikte kaynatmak gerekiyor. İlk kaynamada üzümler üstteki resimde görüldüğü gibi suya renklerini veriyorlar. Daha sonra bu kaynamış üzümleri blender veya mikserden geçirmek lazım. Üzümlerin çekirdeksiz olması bu aşamada önemli. Blender sonrası oluşan karışım yandaki resimdeki gibi görünüyor. Oluşan karışımı ayrıca süzgeçten geçirip posası azaltılabilir. Ama bence posanın kalması hem miktarı artırma açısından hem üzümdeki fiberleri koruma açısından hem de gereksiz israf olmaması açısından daha iyi olacaktır. Bundan sonraki aşama karışımı mısır unu ile karıştırmak. Burada Meksika ürünlerini satan reyonlarda mısır unu bulmak mümkün. Bizde daha önceden alınmış mısır nişastası olduğu için onu kullandık. Yaklaşık 3 yemek kaşığı nişastayı aşağıdaki resimlerdeki gibi koyup karıştırdıktan sonra kaynamasını bekliyoruz. Zaten bu karıştırma işlemi bildiğiniz gibi muhallebi ve çorba gibi yemekler için olmazsa olmaz şartlardan. Kaynama başlar başlamaz ateşten kaldırıp servis kaselerine koyup soğumalarını beklememiz gerekiyor. İsteğe bağlı olarak üzerine hindistan cevizi ve üzüm taneleri koyulabilir. Bir başka sefere sarı üzüm ve burada çok bulunan böğürtlen ve benzeri meyveler (raspberry, blackberry vs) ile de yapmayı planlıyorum. 

Kullandığımız mısır nişastası
Tabaklara servis aşaması
Soğumaya bırakıldıktan hemen sonra


Kaynaklar:

Monday, December 23, 2013

How to rectify imagesc() axis in Matlab?

In Matlab, imagesc() and pcolor() are among the most used 2D plotting commands. For a given 2D matri, when you use the imagesc() command the y-axis comes inverted with respect to pcolor() command. To fix this issue and bring the y-axis increasing in positive y direction (with respect to screen plane), simply using axis xy is sufficient. Here is a small code snippet:


%% Difference between pcolor and imagesc
A=[ 1  2  3  4 7;
    5  6  7  8 -1; 
    9 10 11 12 3;
    2 3 4  6 7;
    9 10 11 12 3;
    1 2 7 -1 10;
    ];

figure (1); clf; set(gcf,'Color',[1 1 1]);
subplot(1,3,1);
pcolor(A); colorbar;
title('{\bf pcolor}(A)'); axis image;

subplot(1,3,2);
imagesc(A); colorbar;
title('{\bf imagesc}(A)'); axis image;

subplot(1,3,3);
imagesc(A); colorbar;
title('{\bf imagesc}(A) with {\bf axis xy}'); axis image;
axis xy
 


- For an earlier post on the difference of imagesc() and pcolor(), check here.
- Another post discusses the inclusion of grid lines to imagesc() here.

Friday, December 06, 2013

Night Train to Turkistan - Google Map of the Stuart Stevens and his company's trip along the Ancient Silk Road

Although the title is enticing, the book itself is not a great book. It focuses more on how the hotels they stayed were, the bus and train details and almost nothing about the culture and history of places they have passed. If you are reading to learn about the Turkistan and its people, this is not the book to do so. It is more about the daily practicality of their journey, how they found the bus/train where they sat and how it was etc. The author is obsessed to follow the route of Fleming without any particular reason and they cannot achieve that. Anyways, one of the nice part of the book is the map it has provided. I transferred it to Google Maps to see how the landscape they pass is and here is the link to that: (Opening the map in full screen mode is recommended)
e

Displaying grid lines in imagesc() function in Matlab


The default plot of pcolor() command in Matlab is to display the grid lines separating the each cell (top right figure below). One can use shading flat to remove the grid lines. However, for the imagesc() command, the default is not to show the grid lines (top left figure below). Below is  simple code snippet showing how to force imagesc() to have grid lines.

nx=4;
ny=4;
A=randn(nx,ny);

figure (8); clf; set(gcf,'Color',[1 1 1]);
subplot(2,2,1); 
imagesc(A); title('plain {\bf imagesc()}'); 
pbaspect([nx ny 1]);

subplot(2,2,2); 
pcolor(A);  title('plain {\bf pcolor()}')
pbaspect([nx ny 1]);

% With grid lines plotted
subplot(2,2,3:4); 
imagesc(A);
pbaspect([nx ny 1]);
title('{\bf imagesc()} with grid lines separating each cell')
set(gca,'xtick', linspace(0.5,nx+0.5,nx+1), 'ytick', linspace(0.5,ny+.5,ny+1));
set(gca,'xgrid', 'on', 'ygrid', 'on', 'gridlinestyle', '-', 'xcolor', 'k', 'ycolor', 'k');
- For an earlier post on the difference between pcolor() and imagesc(), click here.
- Note, syntax highligthing achieved by http://tohtml.com/matlab/