How to replace negative elements in a Matrix with zeros?
A = [2, 3, -1, 5;
-1, 4, -7, -3;
-6, 0, 3, 9;
7, 6, -3, 8];
B = [9;
17;
15;
-3];
AI = inv(A)
I = A*AI
X = AI*B
A*X
Now I am trying to set up a nested for loop to redefine negative elements in A. I need to replace negative elements in A with a zero. How do I go about doing this?A = [2, 3, -1, 5;
-1, 4, -7, -3;
-6, 0, 3, 9;
7, 6, -3, 8];
B = [9;
17;
15;
-3];
AI = inv(A)
I = A*AI
X = AI*B
A*X
Now I am trying to set up a nested for loop to redefine negative elements in A. I need to replace negative elements in A with a zero. How do I go about doing this? A = [2, 3, -1, 5;
-1, 4, -7, -3;
-6, 0, 3, 9;
7, 6, -3, 8];
B = [9;
17;
15;
-3];
AI = inv(A)
I = A*AI
X = AI*B
A*X
Now I am trying to set up a nested for loop to redefine negative elements in A. I need to replace negative elements in A with a zero. How do I go about doing this? matrix, for loops MATLAB Answers — New Questions