% Author: Layla S. Mayboudi
% 2021-05-27
% This code solves three equation sets, each consisting of three state variables.
% The purpose is to study use of the linear solver for three cases, one
% being almost ill-conditioned.


clear all; clc; clf; close all;

a=2; b=0; c=2*i+3;
fprintf('a = %d b = %d c = %d \n',a,b,c);
aa=logical(a); bb=logical(b); 
fprintf('aa = %d bb = %d \n',aa,bb);
%cc=logical(c)

b=single(5)
display('single(c):')
whos b

c=double(5)
display('double(b):')
whos c


A=[1 2 3;2 3 4;3 4 1]
B=[6 4 1]
linsolve(A,B')

AA=[1 2 3;2 3 4;3 4 1]
BB=[6 4 1;5 3 0;4 2 -1]
linsolve(AA,BB)

AAA=[1 4 7;10 14 18;20 25 30]
BBB=[1;4;7]
linsolve(AAA,BBB)