Class Notes (838,402)
Canada (510,881)
York University (35,470)
ESSE 2470 (4)
all (4)
Lecture

eats_2470_lab2_report.doc

13 Pages
177 Views
Unlock Document

Department
Earth, Space Science and Engineering
Course
ESSE 2470
Professor
All Professors
Semester
Winter

Description
qwertyuiopasdfghjklzxcvbnmqwertyuiopa sdfghjklzxcvbnmqwertyuiopasdfghjklzxc vbnmqwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklEATS 2470­ INTRODUCTION TO  klzxcvbnmqwertyuiopasdfghjklzxcvbnmq Lab #2­ CVectortion of  Eigen values & Eigen  wertyuiopasdfghjklThaslim G- 207 243 405 dfghjklzxcvbnmqwertyuiopasdfghjklzxcv bnmqwertyuiopasdfghjklzxcvbnmqwertyu iopasdfghjklzxcvbnmqwertyuiopasdfghjkl zxcvbnmqwertyuiopasdfghjklzxcvbnmqw ertyuiopasdfghjklzxcvbnmqwertyuiopasdf ghjklzxcvbnmqwertyuiopasdfghjklzxcvbn mqwertyuiopasdfghjklzxcvbnmrtyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzxcvb nmqwertyuiopasdfghjklzxcvbnmqwertyui opasdfghjklzxcvbnmqwertyuiopasdfghjkl CONTENTS CONTENTS.................................................................................................................................2 INTRODUCTION:........................................................................................................................3 SAMPLE CODE...........................................................................................................................3 DISCUSSION............................................................................................................................10 OUTPUT....................................................................................................................................11 INPUT -1...............................................................................................................................11 OUTPUT-1............................................................................................................................11 INPUT -2................................................................................................................................12 OUTPUT-2............................................................................................................................12 CONCLUSION...........................................................................................................................13 INTRODUCTION: The main objective of this lab is to use FORTRAN programming to calculate the eigenvalues and eigenvectors for the given matrix in the assignment. SAMPLE CODE !Eatslab_2 program EigenvalueEigenvectore parameter (n=3, np=3) integer i,j, finish real a(np,np) real d(np),e(np) open(10,file='out.txt') open (unit = 2, file = "lab3.txt") do i=1,n read(2,*, iostat = finish) (a(i,j),j=1,n) if (finish .lt. 0.) then exit end if end do close (5) !----------------------------------- write(10,*) 'Given Matrix' write(10,*) ' i j Aij' do i=1,n do j=1,n write (10,'(2I11,1pE14.5)'), i,j,a(i,j) end do end do !----------------------------------- call tred2(a,n,np,d,e) call tqli(d,e,n,np,a) !----------------------------------- write(10,*) 'Eigenvalues' write(10,*) ' i di' do i=1,np write (10,*) i,d(i) end do write(10,*) 'Eigenvectors' write(10,*) ' i j Eij' do j=1,n do i=1,n if(i.eq.1) write (10,'(2I11,1pE14.5)') j,i,a(i,j) if(i.ne.1) write (10,'(I22,1pE14.5)') i,a(i,j) end do write (10,*) end do !---------------------------------- close(10) stop end !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ SUBROUTINE tred2(a,n,np,d,e) INTEGER n,np REAL a(np,np),d(np),e(np) INTEGER i,j,k,l REAL f,g,h,hh,scale do 18 i=n,2,-1 l=i-1 h=0. scale=0. if(l.gt.1)then do 11 k=1,l scale=scale+abs(a(i,k)) 11 continue if(scale.eq.0.)then e(i)=a(i,l) else do 12 k=1,l a(i,k)=a(i,k)/scale h=h+a(i,k)**2 12 continue f=a(i,l) g=-sign(sqrt(h),f) e(i)=scale*g h=h-f*g a(i,l)=f-g f=0. do 15 j=1,l ! Omit following line if finding only eigenvalues a(j,i)=a(i,j)/h g=0. do 13 k=1,j g=g+a(j,k)*a(i,k) 13 continue do 14 k=j+1,l g=g+a(k,j
More Less

Related notes for ESSE 2470

Log In


OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit