function A = frank ( n ) % % function A = frank ( n ) % % Discussion: % % FRANK sets up the Frank matrix. % % Example: % % N = 5 % % A = [ 5 4 3 2 1; % 4 4 3 2 1; % 0 3 3 2 1; % 0 0 2 2 1; % 0 0 0 1 1 ] % % Modified: % % 12 February 2000 % % Author: % % John Burkardt % % Parameters: % % Input, integer N, the order of the matrix. % % Output, real A(N,N), the Frank matrix. % A = zeros ( n, n ); for i = 1 : n for j = 1 : n if ( j < i-1 ) elseif ( j == i-1 ) A(i,j) = n+1-i; elseif ( j > i-1 ) A(i,j) = n+1-j; end end end