⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lec5mldemo1.m

📁 麻省理工ComputationalMethod
💻 M
字号:
% MIT 18.335 - Lecture 5 MATLAB Demo 1% Classical vs. Modified Gram-Schmidt% See also Trefethen/Bau, Lecture 9, Experiment 2% Per-Olof Persson, September 21, 2006% Show how to create a random orthogonal matrixn=5;[Q,X]=qr(randn(n));Qpause% Show how to make an ill-conditioned Rn=5;R=diag(2.^(-1:-1:-n))pauseR=diag(2.^(-1:-1:-n))*triu(ones(n))pauseR=diag(2.^(-1:-1:-n))*triu(ones(n)+0.1*randn(n))pause% Now for the real demonstration% Create random Q and ill-conditioned R for n=80% Compute QR factorization with classical and with% modified GS, compare diagonal elements of computed R's.n=80;R=diag(2.^(-1:-1:-n))*triu(ones(n)+0.1*randn(n));[Q,X]=qr(randn(n));A=Q*R;[QC,RC]=clgs(A);[QM,RM]=mgs(A);semilogy(1:80,diag(RC),'o',1:80,diag(RM),'x',1:80,diag(R))grid on

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -