%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% createscalarfield
%
% Create a scalar field, and saves it to an ASCII file.
%
% Author:  Carlos J. Cela <carlos.cela@utah.edu>
% Version: V1.0, 2012-01-08
% License: Please feel free to use this for anything you need.
%
% Use:
%       createscalarfield( fileName)
%
%   Where
%           fileName = Name of file to save data to.

%           Scalar field is defined in variable sf.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [sx sy] = createscalarfield( fileName )

  % Define scalar field
  for x = 1:100;
    for y = 1:100;
      sf(x, y) = sin(2*pi*x/100)+cos(2*pi*y/100);
    end
  end

  imagesc(sf);

  % Save to file
  save('-ascii', fileName, 'sf'); 

end
