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

📄 ex317wif.m

📁 Advanced Engineering Mathematics using MATLAB by Harman, Dabney, Richert,书中全部源码
💻 M
字号:
% EX317WIF.M  20 x 20 hilbert%   Test the condition number and error in Hilb20*x=b%      x=[1 1 1 ....1]clear                  % Clear variables and the screenclcformat rat             % Rational numbersHilb20=hilb(20);       % 20 x 20% Look at a few entriesHilrow1=Hilb20(1,:)    % First row  1  1/2  ...... 1/n	pause                  % Strike a key to continue    Hilrow20=Hilb20(20,:)  % 20th row 1/20 .....      1/(2n-1)pause%% Find b in Hilb20 * x =b  %xexact=ones(20,1);     % Column matrixb=Hilb20*xexact        % Constant (displayed)pause%%  Let MATLAB try and solve it and then display errors%format long ecnHilb20 = cond(Hilb20)  % Condition Numberpausexcomp = Hilb20\b         % Computed value of solutionpause                    % Note MATLAB's messagefprintf('Error in calculated value\n')xerror=xcomp - xexact   % Display error in each component%pauseformat shortxcomp               % Easier to understand the error%% Display error in bcomp to see how far it is off %pausebcomp = Hilb20*xcomp;    % Look at bcomp if desired    errorb=bcomp-b%%   The result is misleading bcomp is close but xcomp is way off%

⌨️ 快捷键说明

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