function a = fibonacci3_matrix ( n )

%*****************************************************************************80
%
%% fibonacci3_matrix() returns the FIBONACCI3 matrix.
%
%  Example:
%
%    N = 5
%
%    1 -1  0  0  0
%    1  1 -1  0  0
%    0  1  1 -1  0
%    0  0  1  1 -1
%    0  0  0  1  1
%
%  Properties:
%
%    A is generally not symmetric: A' /= A.
%
%    A is tridiagonal.
%
%    Because A is tridiagonal, it has property A (bipartite).
%
%    A is banded, with bandwidth 3.
%
%    A is integral: int ( A ) = A.
%
%    The determinant of A is the Fibonacci number F(N+1).
%
%    The family of matrices is nested as a function of N.
%
%    A is not diagonally dominant.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    08 October 2007
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the order of A.
%
%  Output:
%
%    real A(N,N), the matrix.
%
  a = zeros ( n, n );

  for i = 2 : n
    a(i,i-1) = 1.0;
  end

  for i = 1 : n
    a(i,i) = 1.0;
  end

  for i = 1 : n - 1
    a(i,i+1) = -1.0;
  end

  return
end
