MATLAB: How to display latex expression with natural log in a plot’s legend

latexlegendMATLAB

I'm having trouble getting the following LaTex expression to display in the legend. I used those expresions in the Live Editor's Insert Latex Equation and they were accepted so I'm not sure why I'm getting the warning.
LatexInLegend.jpg

Best Answer

You have to begin and end each part of the expression with dollar-signs ($).
So:
'$e^\frac{ln(k)}{k}(t-k)$'
and so for the rest.