MATLAB Examples

alt_4_50b.m

Contour plot after loess2 surface fit.

load galaxy

contourValue = 1420:20:1780;
contourLabel = 1440:40:1760;
alpha = 0.25;
lambda = 2;

%  Smooth and grid the data
XI = -25:2:25;
YI = (-45:2:45)';
nx = length(XI);
ny = length(YI);
newx = repmat(XI,ny,1);
newy = repmat(YI,1,nx);
newz = loess2(EastWest,NorthSouth,Velocity,newx,newy,alpha,lambda,1);

%  Filled contour plot
contourf(newx,newy,newz,contourValue);
xlabel('East-West Coordinate (arcsec)')
ylabel('North-South Coordinate (arcsec)')
title('Galaxy velocity')
axis image

%  Plot data locations.
hold on
hg = plot(EastWest,NorthSouth,'k.');
set(hg,'MarkerSize',5)
hold off
colormap jet
colorbar