How do I use a plus and minus in a variable

12 views (last 30 days)
Example :
B=5+-4

Answers (1)

DGM
DGM on 6 Mar 2022
Edited: DGM on 6 Mar 2022
If we're simply working with numeric variables, something like this may work:
B = 5 + [4 -4]
B = 1×2
9 1
Or in cases where the +/- term is verbose, you might use a simple multiplication to avoid repeating the term:
B = 5 + [1 -1]*cosd(12+90) % or some other expression
B = 1×2
4.7921 5.2079

Categories

Find more on Historical Contests in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!