%% Add Title to Legend
% Plot two lines and create a legend. Then, add a title to the legend.

x = linspace(0,pi);
y1 = cos(x);
plot(x,y1)

hold on
y2 = cos(2*x);
plot(x,y2)
hold off

lgd = legend('cos(x)','cos(2x)');
title(lgd,'My Legend Title')

% Copyright 2012 The MathWorks, Inc.