summaryrefslogtreecommitdiff
path: root/70/CH3
diff options
context:
space:
mode:
Diffstat (limited to '70/CH3')
-rwxr-xr-x70/CH3/EX3.1.1/3_1_1.sci10
-rwxr-xr-x70/CH3/EX3.1.2/3_1_2.sci5
-rwxr-xr-x70/CH3/EX3.1.3/3_1_3.sci13
-rwxr-xr-x70/CH3/EX3.2.1/3_2_1.sci12
-rwxr-xr-x70/CH3/EX3.2.2/3_2_2.sci9
-rwxr-xr-x70/CH3/EX3.2.3/3_2_3.sci10
-rwxr-xr-x70/CH3/EX3.3.1/3_3_1.sci11
-rwxr-xr-x70/CH3/EX3.3.2/3_3_2.sci18
-rwxr-xr-x70/CH3/EX3.4.1/3_4_1.sci10
-rwxr-xr-x70/CH3/EX3.4.2/3_4_2.sci10
-rwxr-xr-x70/CH3/EX3.4.3/3_4_3.sci15
-rwxr-xr-x70/CH3/EX3.4.4/3_4_4.sci16
-rwxr-xr-x70/CH3/EX3.4.5/3_4_5.sci17
13 files changed, 156 insertions, 0 deletions
diff --git a/70/CH3/EX3.1.1/3_1_1.sci b/70/CH3/EX3.1.1/3_1_1.sci
new file mode 100755
index 000000000..45b6c7be8
--- /dev/null
+++ b/70/CH3/EX3.1.1/3_1_1.sci
@@ -0,0 +1,10 @@
+//page 143
+clear;
+close;
+clc;
+x1=[2;2;-1];
+disp(x1,'x1=');
+x2=[-1;2;2];
+disp(x2,'x2=');
+disp(x1'*x2,'x1''*x2=');
+disp('Therefore,X1 is orthogonal to x2 .Both have length of sqrt(14).') \ No newline at end of file
diff --git a/70/CH3/EX3.1.2/3_1_2.sci b/70/CH3/EX3.1.2/3_1_2.sci
new file mode 100755
index 000000000..af56c526b
--- /dev/null
+++ b/70/CH3/EX3.1.2/3_1_2.sci
@@ -0,0 +1,5 @@
+//page 144
+clear;
+close;
+clc;
+disp('Suppose V is a plane spanned by v1=(1,0,0,0) and v2=(1,1,0,0).If W is the line spanned by w=(0,0,4,5),then w is orthogonal to both v''s.The line W will be orthogonal to the whole plane V.') \ No newline at end of file
diff --git a/70/CH3/EX3.1.3/3_1_3.sci b/70/CH3/EX3.1.3/3_1_3.sci
new file mode 100755
index 000000000..e4fdf2d43
--- /dev/null
+++ b/70/CH3/EX3.1.3/3_1_3.sci
@@ -0,0 +1,13 @@
+//page 145
+clear;
+close;
+clc;
+A=[1 3;2 6;3 9];
+disp(A,'A=');
+ns=kernel(A);
+disp(ns,'Null space=');
+disp(A(1,:)*ns,'A(1,:)*ns=');
+disp(A(2,:)*ns,'A(2,:)*ns=');
+disp(A(3,:)*ns,'A(3,:)*ns=');
+disp('This shows that the null space of A is orthogonal to the row space.');
+//end
diff --git a/70/CH3/EX3.2.1/3_2_1.sci b/70/CH3/EX3.2.1/3_2_1.sci
new file mode 100755
index 000000000..9fb608a03
--- /dev/null
+++ b/70/CH3/EX3.2.1/3_2_1.sci
@@ -0,0 +1,12 @@
+//page 155
+clear;
+close;
+clc;
+b=[1;2;3];
+disp(b,'b=');
+a=[1;1;1];
+disp(a,'a=')
+x=(a'*b)/(a'*a)
+disp(x*a,'Projection p of b onto the line through a is x^*a=');
+disp((a'*b)/(sqrt(a'*a)*sqrt(b'*b)),'cos(thetha)=');
+//end \ No newline at end of file
diff --git a/70/CH3/EX3.2.2/3_2_2.sci b/70/CH3/EX3.2.2/3_2_2.sci
new file mode 100755
index 000000000..537434464
--- /dev/null
+++ b/70/CH3/EX3.2.2/3_2_2.sci
@@ -0,0 +1,9 @@
+//page 156
+clear;
+close;
+clc;
+a=[1;1;1];
+disp(a,'a=');
+P=(a*a')/(a'*a);
+disp(P,'Matrix that projects onto a line through a=(1,1,1) is');
+//end \ No newline at end of file
diff --git a/70/CH3/EX3.2.3/3_2_3.sci b/70/CH3/EX3.2.3/3_2_3.sci
new file mode 100755
index 000000000..b04e96474
--- /dev/null
+++ b/70/CH3/EX3.2.3/3_2_3.sci
@@ -0,0 +1,10 @@
+//page 156
+clear;
+close;
+clc;
+thetha=45; //Taking some value for thetha
+a=[cos(thetha);sin(thetha)];
+disp(a,'a=');
+P=(a*a')/(a'*a);
+disp(P,'Projection of line onto the thetha-direction(thetha taken as 45) in the x-y plane passing through a is ');
+//end \ No newline at end of file
diff --git a/70/CH3/EX3.3.1/3_3_1.sci b/70/CH3/EX3.3.1/3_3_1.sci
new file mode 100755
index 000000000..d78ea2f5c
--- /dev/null
+++ b/70/CH3/EX3.3.1/3_3_1.sci
@@ -0,0 +1,11 @@
+//page 165
+clear;
+close;
+clc;
+A=rand(4,4);
+disp(A,'A=');
+P=A*inv(A'*A)*A';
+disp('P=A*inv(A''*A)*A');
+disp(P,'Projection of a invertible 4x4 matrix on to the whole space is:');
+disp('Its identity matrix.')
+//end \ No newline at end of file
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
diff --git a/70/CH3/EX3.4.1/3_4_1.sci b/70/CH3/EX3.4.1/3_4_1.sci
new file mode 100755
index 000000000..3b9c0e549
--- /dev/null
+++ b/70/CH3/EX3.4.1/3_4_1.sci
@@ -0,0 +1,10 @@
+//page 175
+clear;
+close;
+clc;
+thetha=45;//Taking some value for thetha.
+Q=[cos(thetha) -sin(thetha);sin(thetha) cos(thetha)];
+disp(Q,'Q=');
+disp(Q','Q''=inv(Q)=');
+disp('Q rotates every vector through an angle thetha, and Q'' rotates it back through -thetha.The columns are clearly orthogonal and they are orthonormal because sin^2(theta)+cos^2(thetha)=1.');
+//end
diff --git a/70/CH3/EX3.4.2/3_4_2.sci b/70/CH3/EX3.4.2/3_4_2.sci
new file mode 100755
index 000000000..31158953d
--- /dev/null
+++ b/70/CH3/EX3.4.2/3_4_2.sci
@@ -0,0 +1,10 @@
+//page 175
+clear;
+close;
+clc;
+disp('Any permutation matrix is an orthogonal matrix.The columns are certainly unit vectors and certainly orthogonal-because the 1 appears in a differnt place in each column')
+P=[0 1 0;0 0 1;1 0 0];
+disp(P,'P=');
+disp(P','inv(P)=P''=');
+disp(P'*P,'And,P''*P=');
+//end \ No newline at end of file
diff --git a/70/CH3/EX3.4.3/3_4_3.sci b/70/CH3/EX3.4.3/3_4_3.sci
new file mode 100755
index 000000000..4379185e2
--- /dev/null
+++ b/70/CH3/EX3.4.3/3_4_3.sci
@@ -0,0 +1,15 @@
+//page 175
+clear;
+close;
+clc;
+disp('If we project b=(x,y,z) onto the x-y plane then its projection is p=(x,y,0),and is the sum of projection onto x- any y-axes.')
+b=rand(3,1);
+q1=[1;0;0];
+disp(q1,'q1=');
+q2=[0;1;0];
+disp(q2,'q2=');
+P=q1*q1'+q2*q2';
+disp(P,'Overall projection matrix,P=');
+disp('and,P[x;y;z]=[x;y;0]')
+disp('Projection onto a plane=sum of projections onto orthonormal q1 and q2.')
+//end \ No newline at end of file
diff --git a/70/CH3/EX3.4.4/3_4_4.sci b/70/CH3/EX3.4.4/3_4_4.sci
new file mode 100755
index 000000000..b6e3a85e0
--- /dev/null
+++ b/70/CH3/EX3.4.4/3_4_4.sci
@@ -0,0 +1,16 @@
+//page 166
+clear;
+close;
+clc;
+disp('y=C+Dt');
+disp('Ax=b');
+A=[1 -3;1 0;1 3];
+disp(A,'A=');
+y=rand (3,1);
+disp(y,'y=');
+disp('the columns of A are orthogonal,so')
+x=zeros(1,2);
+disp(([1 1 1]*y)/(A(:,1)'*A(:,1)),'C^ =');
+disp(([-3 0 3]*y)/(A(:,2)'*A(:,2)),'D^ =')
+disp('C^ gives the besy fit ny horizontal line, whereas D^t is the best fit by a straight line through the origin.')
+//end \ No newline at end of file
diff --git a/70/CH3/EX3.4.5/3_4_5.sci b/70/CH3/EX3.4.5/3_4_5.sci
new file mode 100755
index 000000000..6ff7ff7d0
--- /dev/null
+++ b/70/CH3/EX3.4.5/3_4_5.sci
@@ -0,0 +1,17 @@
+//page 166
+clear;
+close;
+clc;
+A=[1 0 1;1 0 0;2 1 0];//independent vectors stored in columns of A
+disp(A,'A=');
+[m,n]=size(A);
+for k=1:n
+ V(:,k)=A(:,k);
+ for j=1:k-1
+ R(j,k)=V(:,j)'*A(:,k);
+ V(:,k)=V(:,k)-R(j,k)*V(:,j);
+ end
+ R(k,k)=norm(V(:,k));
+ V(:,k)=V(:,k)/R(k,k);
+end
+disp(V,'Q=')