Plus and minus sign for an equation

조회 수: 1,035 (최근 30일)
Rooy
Rooy 2012년 3월 18일
댓글: Walter Roberson 2018년 4월 27일
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
Walter Roberson 2012년 3월 18일
No.
t1=((xx+yy)/2);
t2=sqrt((((xx+yy)^2)/2)+xy^2);
a=[t1+t2, t1-t2];
  댓글 수: 1
Rooy
Rooy 2012년 3월 18일
Thank you for the help

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Naresh Virothi
Naresh Virothi 2018년 4월 27일
how to type plus or minus symbol in matlab
  댓글 수: 2
John D'Errico
John D'Errico 2018년 4월 27일
Please don't add an answer just to ask a question.
And there is no plus OR minus symbol in MATLAB, that is, a symbol that indicates EITHER plus or minus.
Unless of course you just mean a string.
'+/-'
ans =
'+/-'
Walter Roberson
Walter Roberson 2018년 4월 27일
>> 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

댓글을 달려면 로그인하십시오.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by