clcondno.m
来自「Advanced Engineering Mathematics using M」· M 代码 · 共 18 行
M
18 行
% CLCONDNO.M Solve A*x=b for A a 5x5 Hilbert matrix% x=[1 1 1 1 1] is answer; xcomp is computed vector% OUTPUT: Condition number (condA) and xerror=xcomp-x% format rat % Show rational valuesformat compact % and suppress blank linesA=hilb(5); % Hilbert matrixb=[137/60 87/60 459/420 743/840 1879/2520]';x=[1 1 1 1 1]; % Exact answer % Check condition number and solvefprintf('Condition number and error in xcomp:\n')condA=cond(A) % Display condition numberformat long % Format decimal valuesxcomp=A\b; % Computed value of solutionfprintf('Error in calculated value xcomp(I), I=1,5\n')xerror=xcomp - x'
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?