fileID = fopen('zipcode.csv');
C = textscan(fileID, '%s %s %s %s %s %s %s');
fclose(fileID);
%celldisp(C)

z = C{1};
z = z(2:end);
z = cellfun(@str2num, z(:,1));

lat = C{4};
lat = lat(2:end);
lat = cellfun(@str2num, lat(:,1));

lon = C{5};
lon = lon(2:end);
lon = cellfun(@str2num, lon(:,1));

[n m] = size(z);	
figure(1);
for i = 1:100:(n-100) 
%    plot(lon(i:i+101),lat(i:i+101),'Color',[(i-1.0)/n sin(pi*(i-1.0)/n)^2 (n-i+1.0)/n], 'LineStyle','-');
%    c = [(i-1.0)/n sin(pi*(i-1.0)/n)^2 (n-i+1.0)/n];
    c = [max((-n+2*i-1.0)/n,0) min((2*i-2.0)/n,(2*n-2*i+2.0)/n) max((n-2*i+1.0)/n,0)];
    plot(lon(i:i+101),lat(i:i+101),'Color',c, 'LineStyle','-');
%    plot(lon(i:i+101),lat(i:i+101),'Color',[(i-1.0)/n 0.0 (n-i+1.0)/n], 'LineStyle','-');
    hold on;
end
hold off;

figure(2);
for i = 1:100:(n-100) 
    xx = sin((90-lat)*pi/180).*cos((lon)*pi/180);
    yy = sin((90-lat)*pi/180).*sin((lon)*pi/180);
    zz = cos((90-lat)*pi/180);
    c = [(i-1.0)/n 0.0 (n-i+1.0)/n];
    plot3(xx(i:i+101),yy(i:i+101),zz(i:i+101),'-','Color',c);
    hold on;
end
hold off;
