function logo(fname) % LOGO Routine lays out CU logo inside a ring. % Input: fname file name onto which the binary data is written % (size(a),a) where a is a 63*63 'double' array. cu=[' XXXXXXXXXX ';... % The array a(i,j) is structured as ' XXXXXXXXXXXX ';... % follows: ' XXXXXXXXXXXXXX ';... % ' XXX XXX ';... % ^ x2 ' XXX XXX ';... % | ' XXX XXX ';... % 63 + - - - - + - - - - + ' XXX XXXXXX XXXXXX';... % 31 ' XXX XXXXXX XXXXXX';... % | | | ' XXX XXXXXX XXXXXX';... % . ' XXX XXX XXX XXX ';... % . | | | ' XXX XXX XXX XXX ';... % -31 31 ' XXX XXX XXX XXX ';... % i + - - - - + - - - - + - > x1 ' XXXXXXXXXXXXXX XXX ';... % ' XXXXXXXXXXXX XXX ';... % . | | | ' XXXXXXXXXX XXX ';... % . ' XXX XXX ';... % | | | ' XXX XXX ';... % -31 ' XXX XXX ';... % 1 + - - - - + - - - - + ' XXXXXXXXXXXXX ';... % ' XXXXXXXXXXX ';... % 1 .. j .. 63 ' XXXXXXXXX ']; % % Create ring x1 = [-31:31]; x2 = [-31:31]; [ax1,ax2] = meshgrid(x1,x2); r = sqrt(ax1.^2+ax2.^2)/31; % Distance to center of grid a = 2*exp(max(-40.0,-6000.0*(r-0.7).^4)).*(1.1-0.75*ax2/31.0); % Place CU logo at the middle of the ring; replace value by 1.2 % wherever there is an 'X' (or other non-blank symbol) in logo a(22:42,22:42) = a(22:42,22:42)+(cu~=' ').*(1.2-a(22:42,22:42)); a = a/max(max(a)); % Normalize a so in range [0,1] % Display test object gridpoint-by-gridpoint using 2-D gray scale gr = gray; % Pick up standard gray map, but swap colormap(gr(64:-1:1,:)) % so 0 values (background) becomes light pcolor(x1,-x2,a) axis equal ; axis tight % Make the output square % Start new figure; surface plot plus grey scale image below figure colormap(gr(64:-1:1,:)) % Again swap direction of grey scale mesh(x1,-x2,a+2) axis ([-32 32 -32 32 0 4]) hold on % Want to do two plots using the same axes pcolor(x1,-x2,a*4) shading interp % Remove grid lines in base plane hold off % Write to a file logo.bin the size of a followed by its values fid = fopen(fname,'w'); if fid==-1 ; error('File could not be opened') ; end; fwrite (fid,[size(a),a(:).'],'double'); fclose (fid);