I have the following three arrays in Matlab:

A size: 2xMxN

B size: MxN

C size: 2xN

Is there any way to remove the following loop to speed things up?

```
D = zeros(2,N);
for i=1:N
    D(:,i) = A(:,:,i) * ( B(:,i) - A(:,:,i)' * C(:,i) );
end

```

Thanks