0
votes

I am trying to compute lim(n->inf) for D^n, where D is a diagonal matrix:

D = [1.0000 0 0 0; 0 0.6730 0 0; 0 0 0.7600 0; 0 0 0 0.7370]
n = 1
L = limit(D^n,n,inf)

This returns the error: Undefined function 'limit' for input arguments of type 'double'.

I am sure this should result in most entries except the upper-left entry going to zero, but I need to be able to present this with MATLAB results. Is there something else I need to include in my limit function?

1
limit is a symbolic function. Are you sure you do not mean syms n; L = limit(D^n,1,inf) - Ander Biguri
Do you have the symbolic math toolbox installed? It's required for the limit function... - Wolfie
Do you really need to present this in MATLAB? It's quite clear that the result will be all zero except for the top left corner. You can see that all diagonals except for the top left one have a value of less than 1, and raising a diagonal matrix to the nth power would simply take the powers of each diagonal individually to the power n with the rest of the matrix set to 0. Therefore, raising those to the infinite power would give you a zero matrix as r^n = 0 if |r| < 1 and n -> infinity. - rayryeng
Correction: zero matrix except for the top-left corner, which should of course be 1. - rayryeng

1 Answers

0
votes

If your problem is to compute the inf-limit of a diagonal matrix, you'd better create your own function and handle manually the possible cases :

function Mlim = get_diag_matrix_inf_limit(M)
  % get the diagonal
  M_diag = diag(M);

  % All possible cases
  I_nan = M_diag <= -1;
  I_0 = abs(M_diag) < 1;
  I_1 = M_diag == 1;
  I_inf = M_diag > 1;

  % Update diagonal
  M_diag(I_nan) = nan;
  M_diag(I_0) = 0;
  M_diag(I_1) = 1;
  M_diag(I_inf) = Inf;

  % Generate new diagonal matrix
  Mlim = diag(M_diag);
end