How to put a hat symbol in the title of a legend ?

10 views (last 30 days)
I tried to write this as a part of my code, after setting the visible display names for the legend:
legend1 = legend('show');
title(legend1,'$\hat{x}$ with # Coeffs','Interpreter','latex');
set(legend1,'Location','northeast');
but I get
'$\hat{x}$ with # Coeffs'
in the title, and not the sign of the hat on x.
Is there a way to solve this ?

Answers (1)

Walter Roberson
Walter Roberson on 10 Apr 2020
title(legend1,'$\hat{x}$ with \# Coeffs','Interpreter','latex');

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!