# Plus and minus sign for an equation

1,567 views (last 30 days)
Rooy on 18 Mar 2012
Commented: Walter Roberson on 27 Apr 2018
I need the plus and minus sign before the square root function, am I doing it right?
a=((xx+yy)/2)+sqrt((((xx+yy)^2)/2)+xy^2);
a=[a,-a];

Walter Roberson on 18 Mar 2012
No.
t1=((xx+yy)/2);
t2=sqrt((((xx+yy)^2)/2)+xy^2);
a=[t1+t2, t1-t2];
Rooy on 18 Mar 2012
Thank you for the help

Naresh Virothi on 27 Apr 2018
how to type plus or minus symbol in matlab
##### 2 CommentsShowHide 1 older comment
Walter Roberson on 27 Apr 2018
>> char(177)
ans =
'±'
However, this has no significance to equations and will be rejected as an error in source code except in comments or character vectors or string objects.
If you need this for labels, then, for example,
text(0.5,0.5,'$\pm$','interpreter','latex')
If you need the minus on top and the plus underneath then \mp