- #1
SteliosVas
- 70
- 0
Homework Statement
Okay basically we have two vectors x and y, and we are required to use the signum function to get the negative and positive ones and preform a operation on them. That is square the positive ones and square root of the absolute value of the negative ones.
x= [ 1:1:10]
y= [ 0.841 0.909 0.141 -0.756 -0.958 -0.279 0.656 0.989 0.412 -0.544]
Homework Equations
Signum function matlab
The Attempt at a Solution
I know if i do: sign(y) I will get values of 1 and -1 (zero possible but not in this case)so for example -1 if the value is <0 and 1 if value > 0
The thing is since this is not a logical statement or I don't think so anyway, I don't know how i can utilize those 1's + and -, to preform an operation
I know if it was logical I could to say value(sign(y)) or use a if statement but not this instance it didn't work...