MATLAB Answers

Is it possible to solve multiple linear systems of equations in parallel with one matrix operation?

조회 수: 1(최근 30일)
Bill Tubbs
Bill Tubbs 2021년 3월 5일
I'm wondering if there's a way to do the following calculations in one go (i.e. without the for loop).
V = nan([na nv]);
for i=1:nv
% Solve homogenous system of equations
V(:,i) = [Aa-L(i)*Ia] \ (-Ba*Phi(i));
For the purposes of this example, let's consider the variables having the following values:
Aa = [ 0.819 0;
-0.544 1];
na = size(Aa,2);
Ba = [1; 0];
Phi = [1 1];
L = [0.7515 0.7165];
nv = numel(L);
Ia = eye(na);
Which yields the solution:
V =
-14.8148 -9.7561
-32.4316 -18.7207


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by