You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: convert_distance_color.m
    path of file: ./repos/gptoolbox/external/toolbox_fast_marching
    
    the code of the file until where you have to start completion: function v = convert_distance_color(D,M)

% convert_distance_color - convert a distance function to a color image
%
%   A = convert_distance_color(D,M);
%
%   M is optional: background image.
%
%   Very useful to save a result of distance computation to an image file
%   with nice colors.
%
%   Copyright (c) 2007 Gabriel Peyre

    
function v = convert_distance_color(D,M)

% convert_distance_color - convert a distance function to a color image
%
%   A = convert_distance_color(D,M);
%
%   M is optional: background image.
%
%   Very useful to save a result of distance computation to an image file
%   with nice colors.
%
%   Copyright (c) 2007 Gabriel Peyre

n = size(D,1);
if nargin<2
    M = ones(n);
end