Thursday, March 18, 2010

EA Sports: 2010 FIFA World Cup Preview

I am addicted to soccer video games from EA SPORTS. I prefer the versions for the national teams (World Cup and EURO competitions) especially when Greece participates. I usually play the games on the PSP (the older version with the disks, not the GO) set at some manageable level (e.g. semi-pro) that allows to destroy the competition and win the cup a few times.

Apart from my nationalistic hedonism they are fun games with an amazing level of detail, even on the PSP system. In addition, graphics-wise each version is much better than the previous one. There is no comparison between say WC2006 and EURO 2008. The latter is a lot more detailed, accurate, closer to the game physics, with better cinematics, and can be very complex (if you aspire to be a pro.) It is probably the only video game that I buy at full price when it releases!

I am looking forward to the WC2010 release.

Tuesday, March 16, 2010

8 Inches!

The rain arrived in Reading on Saturday morning and it did not stop until Monday at midnight. The weather people measured 7.6 inches of rain. That is almost 20 cm!!

  • On Saturday it rained 2.72" (6.9 cm)
  • On Sunday it rained 3.10" (7.9 cm)
  • On Monday it rained 1.79" (4.6 cm)

There was quite a bit flooding especially in Woburn (8.4" of rain) and Winchester. In Woburn one main road was closed because it was under of foot of water. In Arlington I saw hoses emptying water from houses (I assume basements).


I am thankful that the house is dry and that it was not colder and get buried under a mountain of snow. According to the NOAA website:


On average, thirteen inches of snow equals one inch of rain in the US, although this ratio can vary from two inches for sleet to nearly fifty inches for very dry, powdery snow under certain conditions.


That means it could have dumped 100" (8 ft 4 in or 2.5 m) of snow which is an insane amount. Actually, it would be a lot less than that since colder air (required for snow!) can hold a lot less water than 'warm' air as shown in the graph below.

humidity vs TinC_

During the 3 rainy days the temperature here was about 43F (6 degreed C) Assuming a temperature of 32F (0 degrees C) then it seems likely that it would have snowed about 50 inches which is not unheard of. Here people talk all the time about the Great Blizzard of 1978 which dumped over 50 inches of snow in some places. A lot of people that lived through it share horror stories about it. Therefore:


Rain is good. Really!!

03/17/10 Update

Same graph in Fahrenheit scale on the x-axis.

rainPicFinalPlot

Tuesday, March 9, 2010

MATLAB: Generate Rotating Cylinder II

In an earlier cylinder post I put together MATLAB code that could generate a rotating cylinder. The cylinder was described using parametric equations

x = rcostheta 

y = rsintheta

z = z

for z in [0,h] and theta in [0,2pi).

The coloring scheme of the rotating cylinder was defined with indexed values which is a quick way to do it but not very intuitive especially if you are used to RGB (Red-Green-Blue) definitions.

MATLAB makes it easy to specify truecolor that can be used to define the vertex colors (through the CData property) by simply defining an m-by-n-by-3 array, where the 3 corresponds to the RGB triplet. That is, the first m-by-n matrix contains the red components, the second the green components, and the third the blue components of the colors.

For my project I selected an alternating white, light blue, and pink.

The code:

% per MATLAB: white: [1 1 1]
% per MATLAB: light blue: [0.043    0.518    0.780]
% per MATLAB: pink: [1.000    0.600    0.784]

colorIndex = [
   1 1 1;
   0.043    0.518    0.780;
   1.000    0.600    0.784;
   ];

coloring = ones(M,N+1,3); % All white

for id = 2:3:N+1
   for jd = 1:3;
      coloring(:,id,jd) = coloring(:,id,jd) *colorIndex(2,jd);
   end
end

for id = 3:3:N+1
   for jd = 1:3;
      coloring(:,id,jd) = coloring(:,id,jd) *colorIndex(3,jd);
   end
end

First the truecolor scheme parameter coloring is set to white for all values in the m-by-n-by-3 array. The reasons are:

  1. I elected a third of the multi-dimensional array to be white.
  2. Speed up the 2 for-loops.

The for-loops are a quick way to define the other two colors per column for the rest of the array. The rest of the code is the same as shown in the earlier post.

The results is:

 

truecolor_flat

 

 

shading flat

 

 

 

truecolor_interp

 

 

shading interp

Saturday, March 6, 2010

FIFA World Ranking Top 20: March 2010

Rank (previous) Team Points Comment
1 (1) Spain 1642  
2 (2) Brazil 1594  
3 (3) Netherlands 1324  
4 (4) Italy 1226  
5 (6) Germany 1208  
6 (5) Portugal 1201  
7 (7) France 1171 Still overrated.
8 (9) England 1109  
9 (8) Argentina 1087  
10 (12) Greece 1074 Now we are like France; Overrated!
11 (11) Croatia 1050  
12 (13) Russia 1042
13 (19) Serbia 980  
14 (16) Chile 971  
15 (17) Mexico 968  
15 (18) Switzerland 968  
17 (10) Egypt 967 A ranking that makes more sense but much like France.
18 (14) USA 954  
19 (21) Uruguay 936  
20 (20) Cameroon 888  

Point adjustments for most teams. I expect real changes next month after the results of the latest friendly matches. See also related article ‘Rehearsals yield mixed results’ at the FIFA website.

Full table at the FIFA World Ranking website.

Thursday, March 4, 2010

gk.blog: A year later!

One year has passed since I joined the blogosphere. In its inception the goal for gk.blog was to post information that I could easily access and reference from everywhere. A kind of digital scrapbook. I do not think that the goal has really changed.

It turned out that most of the posts during year one have been about MATLAB, Greek national football, and other technology related articles.

Some basic statistical metrics:

Sample: 12

Mean: 5.1 posts/month

Median: 5 posts/month

Std. Deviation: 4.1 posts/month

Min posts: 0 (Oct. 2009)

Max posts: 11 (May 2009)

Graphically (using MATLAB of course):

year1posts copy

NOTES:

  • On average, I publish a new blog entry every 6 days. It seems like a reasonable rate!
  • The sample is not significant enough to allow further analysis.
  • The slump between July and October is due to our move across the US.

Here is to year 2!

Wednesday, March 3, 2010

World Cup 2010 Friendly: Greece 0 – Senegal 2

Bad news! An uninspiring performance by Greece in a friendly at home with a Senegalese team that theoretically has a playing style similar to that of Nigeria (though according to the Senegalese coach ‘they are quicker than the Nigerians.’) Granted, it was a friendly with a lot of absences (e.g. see U21 game) and substitutions for Greece that affected the cohesion of the team but still losing 2-0 at home to a team that it is not even close to the same level as Greece could at least affect morale.

The rest of Group B had much better days:

  • Argentina won away 1-0 against Germany.
  • Nigeria won at home 5-2 against Congo.
  • Korea won away 2-0 against Didier Drogba’s Cote d’Ivoire.

After the game Coach Otto Rehhagel said that ‘we have a lot of work ahead of us.’ That could be an understatement given the good form of the other 3 teams in Group B. Obviously it is not the end of the world. Hopefully, It will serve as a reminder that we only have about 3 months before we play for real.

Reports:

GOAL.com: Greece 0-2 Senegal: Mamadou Niang Gives Coach Amara Traore First Win

UEFA.com: Senegal give Greece food for thought

On a much more positive note, the Greek U21 squad defeated England U21 on an away game! Now we only need 1 point in the final group stage away game against FYROM to win first place in Group 9 (Greece, England, Portugal, Lithuania, FYROM.)

 

Rank Teams P Pts
1 Greece Greece 6 13
2 England England 5 11
3 Portugal Portugal 5 7
4 Lithuania Lithuania 6 5
5 FYR Macedonia FYR Macedonia 6 2

 

Reports:

GOAL.com: England U-21 1-2 Greece U-21: Stuart Pearce’s Side Sink At The Keepmoat Stadium

Guardian.co.uk: Gifted Greeks too good for Stuart Pearce's under-par England

Tuesday, March 2, 2010

MATLAB: Generate Rotating Cylinder

I wanted to play with this as a building block for a bigger project.  (These projects keep me entertained!)

I wanted to write a bit of MATLAB code that would create a colorful rotating cylinder. I know that core MATLAB offers the function cylinder that can generate surfaces of revolution (and thus cylinders!) However, I do not particularly like to be spoon-fed code all the time. Especially when it is straight forward to use a bit of math and code a few extra lines.

Here it goes:

% Define number of points on the x and z axis
N = 64;
M = 32;

% Create points along the x and z axis

x = linspace(-pi, pi, N);
z = linspace(-2, 2, M);

% Create color assignment for each data point.
% Cdata is a property of function surf that defines the vertex colors. A
% matrix containing values that specify the color at every point in ZData.

% Use pseudo-random number generator for ‘unique’ pattern’. Define outside loop to maintain assignment of colors for all iterations.

coloring = rand(M,N+1);

% Code in for-loop to generate rotational motion.

for ii = 1:N
   dummy = [ii:N 1:ii];
   x_ = x(dummy);
   [xx, zz] = meshgrid(x_,z);


   % Use parametric equations
   X = 1 .*cos(xx);
   Y = 1 .*sin(xx);
   Z = zz;


   h = surf(X,Y,Z); % Create 3D surface plot

   axis off
   set(h,'CData',coloring) % Use color scheme defined outside of loop
   shading interp


   F(ii) = getframe; % Get movie frames


   pause(0.1) % To observe motion
end

An AVI movie can be created by playing the movie frames stored in memory:

movie2avi(F, 'rotatingCylinder01.avi', 'fps', 10, 'compression', 'Cinepak')

Random coloring schemes with stripes can be created as follows:

coloring = rand(M,N+1)

scheme01

c = rand(1,N+1);
coloring = repmat(c, [M 1]);

scheme02

c = rand(M,1);
coloring = repmat(c, 1, N+1);

scheme03