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

📄 getmax.m

📁 matlab算法集 matlab算法集
💻 M
字号:
function [p,q] = getmax (A) 
% ---------------------------------------------------------------------- 
% Usage:       [p,q] = getmax (A)
%
% Description: Find the row p and column q of the element of the
%              n by n matrix A above the diagonal whose magnitude
%              is largest.
%
% Inputs:       A = n by n matix
%
% Outputs::     p = row of maximum element above diagonal
%               q = column of maximum element above diagonal 
% ---------------------------------------------------------------------- 

   p = 1;
   q = 2;
   n = size(A,1);
   a = abs (A(p,q));
   for i = 1 : n-1
      for j = i+1 : n
         if abs(A(i,j)) > a 
            p = i;
            q = j;
            a = abs (A(p,q));
         end
      end
   end

⌨️ 快捷键说明

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