From: alex lunax on
Hi all, i need to find general expression from a given matrix A, his k-power. When i type something like:

>> A=[1,1,0,0;0,1,0,0;0,0,3^(0.5),1;0,0,-1,3^(0.5);]

A =

1.0000 1.0000 0 0
0 1.0000 0 0
0 0 1.7321 1.0000
0 0 -1.0000 1.7321

and then

>> syms k
>> A^k
??? Error using ==> sym.mpower
Exponent must be a numeric integer.

Is there any way to get this working? I need this to study a finite system impulse response. Thx.
From: Walter Roberson on
alex lunax wrote:
> Hi all, i need to find general expression from a given matrix A, his
> k-power. When i type something like:
>
>>> A=[1,1,0,0;0,1,0,0;0,0,3^(0.5),1;0,0,-1,3^(0.5);]
>
> A =
>
> 1.0000 1.0000 0 0
> 0 1.0000 0 0
> 0 0 1.7321 1.0000
> 0 0 -1.0000 1.7321
>
> and then
>
>>> syms k
>>> A^k
> ??? Error using ==> sym.mpower
> Exponent must be a numeric integer.

> Is there any way to get this working? I need this to study a finite
> system impulse response. Thx.

If I remember my long ago Linear Algebra classes correctly,

[U,S,V] = svd(A);
Ak = U*diag(diag(S).^k)*V';
From: sscnekro on
Hi alex lunax

> >> A=[1,1,0,0;0,1,0,0;0,0,3^(0.5),1;0,0,-1,3^(0.5);]
> >> syms k
> >> A^k
> ??? Error using ==> sym.mpower
> Exponent must be a numeric integer.

I don't see what your exact purpose is, but maybe this suffices: you can e.g. generate 20 matrices stored in a cell array by
for k = 1:20; B{k} = A^k; end
If you prefer to start with identity matrix, use A^(k-1) instead. If you prefer to have a good level of programming efficiency, wait and hope that a ML Expert will respond.

PS For the case you refer to econometric IRFs (such as in VAR modelling): Do not let confuse yourself by the misleading way IRFs are described in many textbooks. The correct formula is a recursive one and you best read Lutkepohl New Introduction to Multiple TSA. Of course if your "impulse reponses" refer to a different topic, just disregard this.

Good luck.
From: Alan Weiss on
You need to set the assumption that k is a positive integer:

evalin(symengine,'assume(k,Type::PosInt)')

Now you can take powers:

u = A^k

u =

matrix([[1, 1, 0, 0], [0, 1, 0, 0], [0, 0, 3^(1/2), 1], [0, 0, -1,
3^(1/2)]])^k

You can then use the subs command to evaluate u at various values of k.

For more help on assumptions, see
doc(symengine,'assume')
For help in using MuPAD commands in MATLAB, see
http://www.mathworks.com/access/helpdesk/help/toolbox/symbolic/brs6v40.html#brs6wd3

Alan Weiss
MATLAB mathematical toolbox documentation

On 6/3/2010 10:00 AM, alex lunax wrote:
> Hi all, i need to find general expression from a given matrix A, his
> k-power. When i type something like:
>
>>> A=[1,1,0,0;0,1,0,0;0,0,3^(0.5),1;0,0,-1,3^(0.5);]
>
> A =
>
> 1.0000 1.0000 0 0
> 0 1.0000 0 0
> 0 0 1.7321 1.0000
> 0 0 -1.0000 1.7321
>
> and then
>
>>> syms k
>>> A^k
> ??? Error using ==> sym.mpower
> Exponent must be a numeric integer.
>
> Is there any way to get this working? I need this to study a finite
> system impulse response. Thx.