MATLAB: HOw to convert a variable to positive irrespictive of previous

negativepositivesign

A=-3
B= 2
C= 4
D= A+B+C
D=9
As i am working on a loop A or B or C can be negative or positive but i have to put these in D as a positive value only

Best Answer

abs() %gives you positive always which refers to absolute value