diff options
Diffstat (limited to '70/CH3/EX3.3.2/3_3_2.sci')
-rwxr-xr-x | 70/CH3/EX3.3.2/3_3_2.sci | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/70/CH3/EX3.3.2/3_3_2.sci b/70/CH3/EX3.3.2/3_3_2.sci new file mode 100755 index 000000000..e11d64ede --- /dev/null +++ b/70/CH3/EX3.3.2/3_3_2.sci @@ -0,0 +1,18 @@ +//page 166 +clear; +close; +clc; +disp('b=C+Dt'); +disp('Ax=b'); +A=[1 -1;1 1;1 2]; +disp(A,'A='); +b=[1;1;3]; +disp(b,'b='); +disp('If Ax=b could be solved then they would be no errors, they can''t be solved because the points are not on a line.Therefore they are solved by least squares.') +disp('so,A''Ax^=A''b'); +x=zeros(1,2); +x=(A'*A)\(A'*b); +disp(x(1,1),'C^ ='); +disp(x(2,1),'D^='); +disp('The best line is 9/7+4/7t') +//end
\ No newline at end of file |