- #1

member 428835

Hi PF!

I am trying to multiply each component of B by the matrix A and then solve A\C. See the code below.

But there has to be a way to do this without a for-loop, right? I'd really appreciate any help you have!

I am trying to multiply each component of B by the matrix A and then solve A\C. See the code below.

Matlab:

```
A = rand(4);
B = rand(5,1);
C = rand(4,1);
for i = 1:5
sol(:,i) = (B(i)*A)\C
end
```

But there has to be a way to do this without a for-loop, right? I'd really appreciate any help you have!

Last edited by a moderator: