Thursday, December 24, 2009

Wednesday, December 23, 2009

MATLAB gem II: An example

While I was ‘playing’ with the function fdep I decided to write a small M-file to show usage and potential problem.

The code does not produce any useful results but it is not junk either. It calls functions from a few toolboxes. Each function uniquely appears in each toolbox; No ambiguity. Then there is a parameter whose name shadows the name of a MATLAB function.

%% Quick code to test fdep

clear all

% Create 0-mean normal distribution with std = 2
Y = 0 + 2.* randn(1,128);

n = length(Y); % Length of vector n

yy = ceil( max( abs(Y) ) ); % max abs value of data

%% Run sequence plot - MATLAB

subplot(221)
plot(Y, '-')
grid on
axis([1 Inf -yy yy])
title('Run Sequence plot')

%% decimate - Signal Processing Toolbox

YY = decimate(Y,2);

subplot(222)
plot(linspace(1,128,length(YY)), YY, '-')
grid on
axis([1 Inf -yy yy])
title('Decimated Run Sequence plot')

%% Create histogram - MATLAB + Statistics Toolbox

subplot(223)
hist(Y)
hold on
histfit(Y)
hold off
axis([-yy yy 0 Inf])
title('Histogram')

%% Normal probability plot - Statistics Toolbox

subplot(224)
normplot(Y)
title('Normal Probability Plot')

%% Unrelated code: Use parameter named 'step' – MATLAB

lamda = 100;

K = 154;

step = 0;
count = 0;

for id = 1:K+1
   dummy = exp(-lamda) *lamda^(id-1) /factorial(id-1);
   step = step + dummy;
   count = count + 1;
end

The code results in the following plot:

testCode_0912_01

The code is actually 3/4 useful but that is another story.

Now, if you execute fdep from the command line on the M-file shown above the output would look like:

>> P = fdep('testCode_0912_01');
ROOT   : > D:/Documents and Settings/../My Documents/MATLAB/Testing Ground/testCode_0912_01.m
1    1   : | testCode_0912_01      S  0:

-------------  NO USER-DEFINED DEPENDENCIES FOUND
M-FILE       : D:/Documents and Settings/../My Documents/MATLAB/Testing Ground/testCode_0912_01.m
P-FILE       :                                                                                       
MODULE  #   1: testCode_0912_01                                                                      
type         : SCRIPT                                                                                
created      : 23-Dec-2009 12:30:36                                                                  
size         : 1046 bytes                                                                            
lines        : 62                                                                                    
comments     : 9                                                                                     
empty        : 21                                                                                    
recursive    : no                                                                                    
f/eval..     : not used                                                                              
unresolved   : no                                                                                    
calls    TO  :     0  user defined                                                                   
called   FROM:     0  user defined                                                                   
calls in FILE:    20                                                                                 
subfunctions :     0  inside  file                                                                   
nested       :     0                                                                                 
anonymous    :     0                                                                                 
f/eval..     :     0                                                                                 
unresolved   :     0                                                                                 
ML      stock:    13                                                                                 
ML  built-ins:    10                                                                                 
ML    classes:     1                                                                                 
OTHER classes:     0                                                                                 
ML  toolboxes:     4                                                                                 
             :    +1  Control System Toolbox (8.2) [control]                                         
             :    +2  MATLAB (7.7) [matlab]                                                          
             :    +3  Signal Processing Toolbox (6.10) [signal]                                      
             :    +4  Statistics Toolbox (7.0) [stats]                                               
>>

>> P.toolbox

ans =

    'Control System Toolbox (8.2) [control]'
    'MATLAB (7.7) [matlab]'
    'Signal Processing Toolbox (6.10) [signal]'
    'Statistics Toolbox (7.0) [stats]'

>>

Mostly correct; Unfortunately it identifies the presence of the Control Systems Toolbox because of the presence of parameter step. Can’t have everything! Still, a very useful function.

 

Technorati Tags: ,,,,,,

Tuesday, December 22, 2009

MATLAB gem II

Recently I had to figure out which MATLAB toolboxes a massive program is using. The program itself is a smorgasbord of over 5000 (!!) function written by a small army of developers over a number of years. It is a form of spaghetti code based on OOP ideals. Seemingly, no start and no end.
Normally I would not care. I would approach the code as a basic developer and write my new code as needed. I know that applying patches is not a good practice (I really dislike the idea) but my time is a lot more valuable than trying to follow calls forever. However, in this case all that code needs to be installed on more machines. And the installation is temporary. Therefore it makes no sense to buy the full-MATLAB-with-all-toolboxes-plus-Simulink-and-everything-else kind of license we typically buy. Therefore, I had to figure out what exactly that particular program is using.
So I Googled the problem and found exactly what I was looking for in the file exchange of MATLAB Central. The function contributed by us; The contribution is titled fdep: a pedestrian function dependencies finder and it is exactly what I was looking for.
The function (set of functions really) is well written and documented. It very quickly goes through a MATLAB program and displays information about users defined functions, sub-functions, MATLAB functions, toolboxes, calls, etc. Toolboxes!! There is a command line interface and a graphical one. It even comes with an HTML help file. Great work!
One caveat: At least when it comes to the toolboxes the result could be inaccurate. The reason for that is that if a developer is using a parameter name that shadows the name of an existing MATLAB function the the conflict is resolved in favor of MATLAB. For example, if a developer programmed the statement
step = 1;

then fdep will determine that step is the MATLAB function from the Control System Toolbox. That is a problem with namespace littering. And with all the toolboxes available for MATLAB pretty soon all normal dictionary words will shadow some MATLAB function. Anyway…
For my case I used the function fdep in a script that navigated through the mess of code and interrogated each function and printed back the toolbox result. The function worked quickly with few hick-ups and returned reasonable results: A few toolboxes in addition to core MATLAB. It might be that a couple of them seem suspicious but the effort required to uncover details is out of scope!
Technorati Tags: ,,,,

Sunday, December 20, 2009

The first big snowstrom (for a second time!)

I have survived snowstorms in MA before (years ago) but it is always… interesting to wake up surrounded by a foot of snow. Of course it helps to reside in an apartment. The best thing about living in an apartment is the sense of freedom. The second best is that I do not have to clear driveways and sidewalks of all the snow!

The snowfall probably started after 1:00 am and it accumulated very quickly. By 9:00 am Reading was transformed to a winter wonderland. A cold one though; The temperature was around –5C throughout the day.

01Dec.09.Boston_ 02Dec.10.Boston_

The snow was the kind of dry, fluffy snow that you cannot even use for a snowball fight, or to make a snowman (though we tried!) and it kept falling until about 1:00 pm. The maintenance people here were clearing the side walks and the snow ploughs were pushing snow out of the way for most of the day.

Everything was buried pretty deep. The Jeep is very useful during winter in MA!

007 010

Friday, December 18, 2009

FIFA World Ranking Top 20: December 2009

Rank (previous) Team Points Comment
1 (2) Spain 1627  
2 (1) Brazil 1568  
3 (3) Netherlands 1288  
4 (4) Italy 1209  
5 (10) Portugal 1176 That actually is about right.
6 (4) Germany 1173  
7 (9) France 1117 And that is not even close to being right…
8 (6) Argentina 1085  
9 (7) England 1076  
10 (8) Croatia 1042  
11 (14) Cameroon 1035  
12 (12) Russia 1026 Did not even make it to South Africa!
13 (16) Greece 1016 Home tie and away win against Ukraine in November (play-offs for World Cup qualification.)
14 (11) USA 980  
15 (17) Chile 936  
16 (19) Cote d’Ivoire 934  
17 (18) Mexico 931  
18 (13) Switzerland 924  
19 (20) Serbia 916  
20 (19) Uruguay 909  

Full table can be found at FIFA World Ranking.

Thursday, December 17, 2009

Military Could Use iPhones to Track Friends, Enemies in War

Military Could Use iPhones to Track Friends, Enemies in War

That is some pretty cool technology developed by Raytheon. And if ever Raytheon goes into the video game business their developers could develop some great strategy games.

The original article from the New York Times appeared in the Bits Blog.
The press releases from Raytheon can be found here and here.

I would assume that Apple would need to make a more rugged version of the iPod to turn it into a useful tool in the battlefield (No Doubt Mission Assurance and everything.) The biggest struggle might be for Raytheon and the US government to convince the image-conscious Apple to go for something like that!

Sunday, December 6, 2009

Yahoo Issues Takedown Notice for Spying Price List

Yahoo Issues Takedown Notice for Spying Price List

Once upon a time I respected and liked Yahoo! It seems that it has become much like the telecoms: they treat the customer like a commodity. Exploitation rules! And apparently that includes selling the privacy (whatever that might mean today) of their customers to the government (for now) and who knows who else in the future.

A number of 'lawful spying guides' are posted on Cryptome.org including Verizon, Nextel, GTE, etc.

Such pity...

Saturday, December 5, 2009

Jason & Christina Originals

I think they are pretty cool and I want to preserve them.

091206 J&C Originals copy

Friday, December 4, 2009

2010 World Cup Draw

It could have been worse for Greece which was drawn into group B along with Argentina, Nigeria, and South Korea. The ‘Group of Death’ is G with Brazil (FIFA #1), Ivory Coast (FIFA #16), and Portugal (FIFA #5), along with North Korea. The softest group is F with Italy and Paraguay, New Zealand, Slovakia (all 3 ranked 30 or lower; Italy should have a very pleasant group stage.) The US should go through along with England from group C.

The groups are:

Group A
France (7)
Mexico (15)
Uruguay (19)
South Africa (86)
Group B
Argentina (8)
Greece (12)
Nigeria (22)
South Korea (52)
Group C
England (9)
United States (14)
Algeria (28)
Slovenia (33)
Group D
Germany (6)
Serbia (20)
Australia (21)
Ghana (37)
Group E
Netherlands (3)
Cameroon (11)
Denmark (26)
Japan (43)
Group F
Italy (4)
Paraguay (30)
Slovakia (34)
New Zealand (77)
Group G
Brazil (2)
Portugal (5)
Ivory Coast (16)
North Korea (84)
Group H
Spain (1)
Chile (17)
Switzerland (18)
Honduras (38)

Greece will play against:

  • South Korea on June 12;
  • Nigeria on June 17;
  • Argentina on June 22.

History says that a win and a draw will likely get you through the group stage. Therefore, a win over South Korea (they cannot defend set pieces effectively) and a draw with Nigeria (suspect defense) should be sufficient for Greece to advance to the round of 16. All Greece needs to do is play good suffocating defense and score on quick counter attacks and set pieces. And if Maradona cannot keep his nose clean he might screw Argentina up and give us an advantage (though it would be difficult to mess up Lionel Messi and Co.)

If we advance then we will likely advance as a second seed and thus play against the first seed of group A; most likely that would be France.

GOOD LUCK GREECE!

BTW, actress Charlize Theron is magnificent!

Related articles:

GOAL.com: World Cup 2010: Group B Analysis - Argentina, South Korea, Nigeria, Greece

ESPN.com: Team analysis of the draw

FIFA.com: Group B stirs ghosts of '94

Wednesday, December 2, 2009

Ford Fiesta for the US

Finally the Ford Fiesta will be made available to the US market. The car is beautiful, successful, economic, and iconic in Europe. Not to mention that that it was the runner up for Car of the Year 2009 (losing by just one point!)

Fiesta_in_Vision

According to the official press release from Ford, the Fiesta will be available in the summer of 2010. It will have a 1600 cc 4-cylinder engine (that probably used to be an anathema for the average buyer in the US!) that delivers 119 HP. I expect (hope) that the car is going to be available with all the bells and whistles of the European version (Bluetooth with Voice Command, center console multifunctional display, MP3 & USB ready, rain sensing wipers, key free starter, stability and traction assist, parking assist sensor, etc) and definitely hope that is going to be available with a standard (manual) gearbox.

Fiest_Power_Starter_Button Fiesta_steering_wheel_and_controls Fiesta_Zetec-S_in_Vision Fiesta_auto-headlights

She is gorgeous. If it sells for a price similar to the Focus and VW Golf then the MSRP should be around $17000 which is OK for small family cars that appeal to young people.

Monday, November 23, 2009

The Past

The street view of our old Bothell WA house available on Google Maps.

GoogleMaps_StreetView

We are still very nostalgic about our old house (our old life really.) Leaving behind friends and countless good memories is not easy even if we are close to family and old friends. We hope to find something equally inviting and warm to call home here in MA and start feeling a bit like we are getting closer to normalcy. We hope…

Thursday, November 19, 2009

2010 World Cup Participants FIFA World Ranking – November 2009

Rank Actual Rank Team Points dB re #1 Points Comments
1 1 Brazil 1632

0.00

Top Tier
2 2 Spain 1629

-0.01

Top Tier
3 3 Netherlands 1340 -0.86 Top Tier
4 4 Italy 1215 -1.28 Tier 1
5 5 Germany 1161 -1.48 Tier 1
6 6 Argentina 1103 -1.70 Tier 1
7 7 England 1101 -1.71 Tier 1
8 9 France 1049 -1.92 Tier 1
9 10 Portugal 1042 -1.95 Tier 1
10 11 USA 1025 -2.02 Tier 2
11 13 Switzerland 961 -2.30 Tier 2
12 14 Cameroon 949 -2.36 Tier 2
13 16 Greece 921 -2.49 Tier 2
14 17 Chile 909 -2.54 Tier 2
15 18 Mexico 904 -2.566 Tier 2
16 19 Cote d’Ivoire 903 -2.570 Tier 2
17 20 Serbia 892 -2.62 Tier 2
18 21 Paraguay 879 -2.69 Tier 2
19 24 Australia 848 -2.84 Tier 2
20 25 Uruguay 838 -2.90 Tier 2
21 27 Denmark 830 -2.94 Tier 2
22 29 Algeria 781 -3.20 Tier 3
23 32 Nigeria 763 -3.30 Tier 3
24 33 Slovakia 758 -3.33 Tier 3
25 35 Honduras 754 -3.35 Tier 3
26 38 Ghana 746 -3.40 Tier 3
27 40 Japan 735 -3.46 Tier 3
28 48 Korea Republic 671 -3.86 Tier 3
29 49 Slovenia 663 -3.91 Tier 3
30 83 New Zealand 383 -6.30 Just happy to be there
31 85 South Africa 381 -6.32 Just happy to be there
32 91 Korea DPR 359 -6.58 Just happy to be there

Wednesday, November 18, 2009

South Africa-bound!

Greece made it! Greece won the away game against Ukraine in Donbass Arena with a goal by Dimitrios Salpingidis in the 31st minute after receiving a dream pass from George Samaras that beat the offside trap. Like Charisteas said in an interview:


"It doesn't matter who (of us) scores, but I am very confident (one of us) will."

That scorer was Salpingidis!

A superb team effort by Tzorvas, Moras, Spiropoulos, Samaras, Katsouranis, Charisteas, Karagounis, Vyntra, Salpingidis, Papastathopoulos, Kyrgiakos, Pliatsikas, Tziolis, and Gekas.

CONGRATULATIONS GREECE!

The draw for the 2010 World Cup is on December 4. Looking forward to the opportunity to erase the bad (awful) memories of the 1994 World Cup.

BTW, the first leg (in Athens) ended 0-0.

Related Articles:

FIFA.com: Greeks return to the world stage

ESPN.com: Ukraine 0-1 Greece: Greeks provide Donetsk shock

Goal.com: Ukraine 0-1 Greece: Salpingidis Strike Sends Otto's Men To South Africa

Sunday, November 15, 2009

Leading the Way

That is the title of an article written by Graham Warwick that appeared in the Oct. 26 issue of Aviation Week & Space Technology magazine. In it Raytheon (NYSE:RTN) Chairman and CEO Bill Swanson talks about disruptive and sustaining (incremental) technology innovation. Among other things he said:

“You want an organization where that’s cultivated, but no one side suffers at the expense of the other. I have watched organizations take away resources from the incremental innovation teams to fund those that are disruptive. What you can create are haves and have-not's and that is one way to destroy innovation. You need both.”

Spot on! I too have seen organizations pouring resources on disruptive half-baked ideas at the expense of upgrade releases that actually pay the bills. A good balance is needed.

Frequently these half-baked ideas generate a lot of excitement (possibly rightly so), they become part of the near term product roadmap, and counted on for millions of $ of revenue promised to stakeholders and shareholders. The problem is that more often than not there is no straight path between a widget with blinking lights that some wizard hacked together to address basic usage on a bench and an actual product that works properly per customer requirements (complete with proper HW, SW, safety, documentation, production testing, etc.) Program delays, resource crunch, added costs, etc ensue.

The end result is that the company hurts, the employee morale suffers, and over time upper management loses every bit of credibility. Of course, the mess could be avoided if the people that are selling the disruptive technology up were in touch with reality or if the people that are pushing down to get things out faster knew the difference between feasibility and productization.

Friday, November 13, 2009

FIFA World Ranking Top 20: November 2009

Rank (previous) Team Points Comment
1 (1) Brazil 1632
2 (2) Spain 1629
3 (3) Netherlands 1340
4 (4) Italy 1215
4 (4) Germany 1161
6 (8) Argentina 1103
7 (7) England 1101
8 (9) Croatia 1087
9 (10) France 1049
10 (17) Portugal 1042
11 (11) USA 974
12 (6) Russia 982
13 (15) Switzerland 961
14 (29) Cameroon 949
15 (18) Czech Republic 928
16 (12) Greece 921 Home wins against Latvia and Luxembourg in October (World Cup qualifiers.)
17 (21) Chile 909
18 (24) Mexico 904
19 (20) Cote d’Ivoire 903
20 (13) Serbia 892

Play-off game 1 against Ukraine tomorrow in Athens. Good luck!

Full table can be found at FIFA World Ranking.

It’s been a long, long time…

New state (Massachusetts), new city (Reading), new job (Raytheon), same basic subjects: Propagation and scattering of waves, beamformation, signal processing, modeling and design, and system integration.

We certainly miss our old home in WA and our old neighborhood. Sigh…

Thursday, September 10, 2009

FIFA World Ranking Top 20: September 2009

Rank (previous) Team Points Comment
1 (1) Brazil 1604
2 (2) Spain 1588
3 (3) Netherlands 1376
4 (5) Italy 1186
4 (4) Germany 1186
6 (6) Russia 1129
7 (7) England 1127
8 (8) Argentina 1113
9 (10) Croatia 1101
10 (9) France 1040
11 (12) USA 974
12 (11) Greece 971 Away loss to Poland (friendly)
13 (14) Serbia 916
14 (16) Australia 907
15 (13) Switzerland 898
16 (15) Denmark 892
17 (17) Portugal 880
18 (22) Czech Republic 870
19 (23) Bulgaria 860
20 (18) Cote d’Ivoire 852

Bad omen for Greece…

Saturday, August 8, 2009

FIFA World Ranking Top 20: August 2009

Rank (previous) Team Points Comment
1 (1) Brazil 1642
2 (2) Spain 1590
3 (3) Netherlands 1379
4 (5) Germany 1195
5 (4) Italy 1181
6 (6) Russia 1161
7 (7) England 1135
8 (8) Argentina 1080
9 (9) France 1059
10 (10) Croatia 1031
11 (11) Greece 1001 No new action
12 (12) USA 991
13 (13) Switzerland 930
14 (14) Serbia 925
15 (15) Denmark 909
16 (16) Australia 896
17 (17) Portugal 881
18 (18) Cote d’Ivoire 874
19 (19) Ukraine 869
20 (22) Paraguay 856

A quiet month for all teams. However, September is going to be a critical month for a lot of teams (Greece included.)

Saturday, July 11, 2009

Seattle Sounders vs. Houston Dynamo

Our very first soccer game with Jason. Soccer shirts, (blue) cotton candy, pop corn and lots of cheering. Jason got into it though he got tired towards the end of the game. It was a lot of fun for both of us!

sounders ticket

And on top of it the Sounders won 2-1. Both goals were great. Actually the second one, scored by Patrick Ianni on a bicycle kick was amazing. No accident; The guy lowered and positioned his body perfectly to take the difficult shot (right in front of us!)

Game reports can be found here and here.

Video available from YouTube is shown below.

Wednesday, July 8, 2009

FIFA World Ranking Top 20: July 2009

Rank (previous) Team Points Comment
1 (5) Brazil 1672 Back on top!
2 (1) Spain 1590 Can’t trust them…
3 (2) Netherlands 1379
4 (4) Italy 1229 Lost to Egypt. Enough said.
5 (3) Germany 1207
6 (9) Russia 1161
7 (6) England 1135
8 (7) Argentina 1091
9 (10) France 1082
10 (8) Croatia 1031
11 (17) Greece 1001 No new action
12 (14) USA 983 An amazing opportunity squandered!
13 (16) Switzerland 930
14 (20) Serbia 925
15 (24) Denmark 909
16 (29) Australia 886 +13!! Belonging to Oceania helps!
17 (11) Portugal 879 Unfair. Should be given extra points for Ronaldo.
18 (38) Cote d’Ivoire 874 +20!!! For what? Beating Guinea & Burkina Faso?
19 (19) Ukraine 869
20 (17) Uruguay 860

You can find the latest complete list at the official FIFA website.

Sunday, June 21, 2009

MATLAB: Some useful colormaps

Using methods described in an earlier blog entry I have created various color maps over the years to display data. Some of my favorites are:

1. BURNT

>>   nodes = [
      5 5 5;
      160 36 16;
      178 73 23;
      255 230 0;
      ];


>> index = [1 16 32 64];

MATLAB_07

2. PURPLE HAZE

>>   nodes = [
      10 0 80;
      152 58 151;
      195 145 194;
      218 175 162;
      222 185 222;
      252 220 252;
      ];


>> index = [1 4 13 30 52 64];

MATLAB_08

MATLAB_003B copy

3. RAINBOW

>> nodes = [
      48 0 155;
      0 0 131;
      0 155 254;
      0 188 0;
      254 246 0;
      254 98 48;
      221 0 0
      ];


>> index = [1 12 22 33 43 54 64];

MATLAB_09

MATLAB_003C copy

4. PRIMARY COLORS

>> nodes = [
      0 51 153;
      0 51 153;
      0 153 255;
      0 153 255;
      153 204 255;
      153 204 255;
      0 102 0;
      0 102 0;
      102 204 51;
      102 204 51;
      153 255 102;
      153 255 102;
      255 255 0;
      255 255 0;
      255 153 51;
      255 153 51;
      255 51 0;
      255 51 0;
      ];
 

>> index = [1 7 8 14 15 21 22 28 29 35 36 42 43 49 50 56 57 64];

 

MATLAB primaryColors

5. RED2BROWN

>> nodes = [
      153 102 0;
      204 153 0;
      255 204 0;
      255 255 0;
      255 204 102;
      255 153 51;
      255 51 0;
      153 0 0;
      ];
 

>> index = [1    10    19    28    37    46    55    64];


MATLAB redToBrown

Thursday, June 18, 2009

MATLAB: Colormaps

Colormap is a function (essentially a look-up table) that maps intensity to color. It is a very useful tool because with the right color map you can quickly convey information about particular aspects of an image.

Each colormap is comprised of 64 RGB triplets, each triplet taking values from 0 to 1 (instead of the typical 0 to 255; Why is that?). For examples see table below:

 

Color Red Green Blue
White 1 1 1
Red 1 0 0
Yellow 1 1 0
Blue 0 0 1
 

MATLAB offers a number of color maps (I think 17 on R2008b) which are well thought out. My favorite maps are: default, bone, gray, hot. However, it is very easy to generate your own color maps in order to highlight (or mask) particular aspects of an image.

Say you have an RF signal (40 MHz sampling frequency) in vector x:

>> plot(x)

MATLAB_01

 

You can calculate the time - frequency spectrogram of the signal using the function spectrogram (which replaced the function specgram available in older releases; All these name changes are annoying.) Also use the function colorbar to display the current colormap.

>> spectrogram(x,256,240,256,40)
>> colorbar

MATLAB_02

The spectrogram is displayed with the default colormap which is very good for general purpose display of information. To change the colormap to another predefined one you can use the function colormap. For example:

>> colormap(copper)

MATLAB_03

Too Flat. To go back to original colormap use:

>> colormap('default')

Note that to recall the default color map single quotes are need (for yet another unknown reason!)

Frequently the predefined color maps are not sufficient to generate a useful graphic in a quantitative sense. MATLAB makes it very easy to generate custom maps by offering two possibilities: The one is to use the colormap editor GUI; The other is to do a bit of typing and use your brain at the same time!

To bring up the GUI type (obviously):

>> colormapeditor

MATLAB_04

You can do some cool stuff with the colormap GUI; The help menu has some good examples. The documentation is also available on-line here (but it is frequently slooowww; prefer the local help if it is installed).

However, GUIs are not exactly my thing. I prefer to keep my fingers on the keyboard. So here is what I would do:

Define number of colors in the colormap (as mentioned earlier that is a given).

>> n = 64;

Then define color nodes in realistic RGB color-per-row vectors. The first row specifies the one end of the colormap (in this example almost black) and the last row specifies the opposite end (in this example white). The rest of the rows define colors at specific points in the colormap. You do not need to define all 64 color explicitly (though that is not out of the question). Note that MATLAB does not know the standard RGB triplets so eventually they would have to be normalized (divided by 255).

>>    nodes = [
      10  0 0;
      255 0 0;
      255 255 0;
      255 255 255
      ];

Define the index of each node in the colormap. The first row gets the index 1. The last row gets index 64. The index of the rest of the row vectors (or RGB triplets, or colors, or whatever) will define the rest of the color assignments in the colormap by interpolating between nodes.

>> index = [1 24 48 64];

In this case, index(24) is the 24th color of the colormap and is red ([255 0 0]) while index(48) is the 48th color of the colormap and is yellow ([255 255 0]).

Now we need to define the colors for all the other indices of the color map. There various ways to do that such 1st order polynomial fit per range, spline (not very good since it will introduce unwanted oscillations and thus values out-of-range that you need to take care off but creates some unique maps), etc. A decent way to go about it is to use the function linspace between nodes to create linearly spaced vectors. A first order fit it would be good but more typing!

>> RGBMap = zeros(n,3);

>> for id = 1:size(nodes,1)-1
   for jd = 1:3
      RGBMap(index(id):index(id+1),jd) = ...
         round( ...
         linspace(nodes(id,jd),nodes(id+1,jd),index(id+1)-index(id)+1) ) ./255;
   end
end
>>

Note the division by 255 to change values from 0 to 1 to accommodate MATLAB weirdness.

Invoke map by typing:

>> colormap(RGBMap)

Where, RGBMap is the name of the color map parameter used here.

In this example the colormap is essentially identical to the MATLAB-defined colormap hot (can check using the colormap editor).

A colormap that I might have liked better would be:

>>   nodes = [
      45 25 0;
      200 70 45;
      215 215 20;
      225 225 110;
      170 180 120;
      65 105 200;
      25 25 125;
      ];
>> index = [1 11 22 32 43 55 64];

which would result to the following cleaner image:

MATLAB_05

If I wanted to highlight a particular feature (a specific level) I could use:

>>   nodes = [
      45 25 0;
      200 70 45;
      215 215 20;
      225 225 110;
      170 180 120;
      135 155 147;
      0 255 0;     
      0 255 0;
      91 124 180;
      65 105 200;
      25 25 125;
      ];


>> index = [1 11 22 32 43 47 48 51 52 55 64];

MATLAB_06

And of course I can relate the dB levels with the colormap and indices etc and produce really useful images.