By default, the interpreter is TeX, not LaTeX, so you have this problem. You can use LaTeX as an interpreter for this part by doing something like this:
plot(1); hl = legend('$$\varphi$$'); set(hl,'Interpreter','latex')
or you can set LaTeX as the default interpreter using
set(0,'DefaultTextInterpreter', 'latex');
which can be placed in the startup.m file if you want.
source share