diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /26/CH7/EX7.1.19 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '26/CH7/EX7.1.19')
-rwxr-xr-x | 26/CH7/EX7.1.19/7_1_19.sce | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/26/CH7/EX7.1.19/7_1_19.sce b/26/CH7/EX7.1.19/7_1_19.sce new file mode 100755 index 000000000..5adfd2b7d --- /dev/null +++ b/26/CH7/EX7.1.19/7_1_19.sce @@ -0,0 +1,64 @@ +disp('PD decomposition of a matrix A')
+a=[3 -2 4;-2 6 2;4 2 3]
+disp(a,'A=')
+disp('Eigenvalues of A are')
+eig=spec(a)
+disp(eig)
+disp(eig(2,1),'for lambda =')
+disp('A-(lambda)I=')
+b=a-eig(2,1)*eye(3,3)
+disp(b)
+disp('To find eigenvector, form an augmented matrix')
+c=[b [0;0;0]]
+disp(c)
+disp('performing row operations')
+c(2,:)=c(2,:)-(c(2,1)/c(1,1))*c(1,:)
+c(3,:)=c(3,:)-(c(3,1)/c(1,1))*c(1,:)
+disp(c)
+disp('With x2 and x3 as free variables, we get two vectors.')
+disp('x1=-.5x2+x3')
+disp('Thus, the two vectors are')
+v1=[-1;2;0]
+v2=[1;0;1]
+disp(v2,v1)
+disp('Orthogonalizing v1 and v2')
+disp('Let x1=v1')
+disp('x2=v2-((v2.v1)/(v1.v1))*v1')
+x1=v1
+a1=v2'*v1
+a2=v1'*v1
+x2=v2-(a1/a2)*v1
+x1=x1/(sqrt(x1(1,1)^2+x1(2,1)^2+x1(3,1)^2))
+x1=x2/(sqrt(x2(1,1)^2+x2(2,1)^2+x2(3,1)^2))
+disp('An orthonormal basis is:')
+disp(x2,x1)
+disp(eig(1,1),'for lambda=')
+disp('A-(lambda)I=')
+b=a-eig(1,1)*eye(3,3)
+disp(b)
+disp('To find eigenvector, form an augmented matrix')
+c=[b [0;0;0]]
+disp(c)
+disp('performing row operations')
+c(2,:)=c(2,:)-(c(2,1)/c(1,1))*c(1,:)
+c(3,:)=c(3,:)-(c(3,1)/c(1,1))*c(1,:)
+disp(c)
+c(3,:)=c(3,:)-(c(3,2)/c(2,2))*c(2,:)
+disp(c)
+c(1,:)=c(1,:)/c(1,1)
+c(2,:)=c(2,:)/c(2,2)
+disp(c)
+c(1,:)=c(1,:)-(c(1,2)/c(2,2))*c(2,:)
+disp(c)
+disp('With x3 as free variable')
+disp('x1=x3 and x2=-.5x3')
+disp('Thus a basis for the eigenspace is:')
+v3=[1;-.5;1]
+disp(v3)
+disp('upon normalizing')
+v3=v3/(sqrt(v3(1,1)^2+v3(2,1)^2+v3(3,1)^2))
+disp(v3)
+disp('Thus, matrix P=')
+disp([x1 x2 v3])
+disp('Corresponding matrix D=')
+disp([eig(2,1) 0 0;0 eig(3,1) 0;0 0 eig(1,1)])
\ No newline at end of file |