% How to slove linear equations % consider a linear equation % ax + by = p % cx + dy = q % This equation needs to be expressed in matrix form for % Octave to be able to solve it. That is: % A.X=B % Where A is the coefficients of the left side % A=[a b;c d] and B=[x y] % If A is invertible, X = (1/A)B, or, using Matlab notation, X = A\B. % ----------------------------------------------------------------------- % Now an example: % 4x+3y = 10 % 5x+6y = 32 a=[4 3;5 6]; b=[10;32]; x=a\b