MATLAB: Solving Matrices with Symbolic Variables

matricessymbolic vars

I am trying to figure out how to solve a problem such as [A]{X}={0} where [A] is a numerical matrix such as
[1 2 3 4]
[5 6 7 8]
[9 0 1 2]
and {X} is a symbolic matrix with a single numeric value such as
[1x1 sym; 1x1 sym; 1x1 sym; 1]
that is:
[a]
[b]
[c]
[1]
Is there a way to find a,b,c such that [A]{X}={0}

Best Answer

A =[ 1 2 3 4
5 6 7 8
9 0 1 2]
syms a b c
x = [a;b;c]
k = A(:,1:3)\-A(:,end);
for i1 = 1 : numel(x)
eval([char(x(i1)),'=k(i1)']);
end
Related Question