func12.m
资源名称:数值分析课程设计.zip [点击查看]
上传用户:zhdd911129
上传日期:2007-05-11
资源大小:722k
文件大小:0k
源码类别:
matlab例程
开发平台:
Matlab
- %func12.m
- %Find eigenvalue,using QR methom
- m=[5,-3,2;6,-4,4;4,-4,5]
- maxtimes=1000
- a=m
- start=now
- for i=1:maxtimes
- [Q,R]=qr(a)
- b=a
- a=R*Q
- if (abs(norm(a,inf)-norm(b,inf))<1e-4)
- disp('iteration times:')
- disp(i)
- break
- end
- end
- finish=now
- disp('Elapse time:')
- disp(finish-start)
- %a =
- % 2.9999 -1.0001 -12.0002
- % -0.0001 2.0001 -1.9989
- % 0.0000 -0.0000 1.0000
- %iteration times:
- % 22
- %Elapse time:
- % 0.090s