评估常规矩阵函数
F= funm(A,fun)
f = funm(一个,有趣,选择)
f = funm(一个,有趣,选项,p1,p2,...)
[F,EXITFLAG] = FUNM(...)
[F,exitflag,output] = funm(...)
F= funm(A,fun)
评估用户定义的函数Fun
在方形矩阵论证一种
。f = fun(x,k)
must accept a vectorX
和一个整数K.
那and return a vectorF
相同的大小X
, 在哪里f(i)
是theK.
函数的衍生物Fun
evaluated atX(i)
。乐趣表示的功能必须具有泰勒系列,除了有趣= @log.
,被视为一个特例。
你也可以使用fun
在矩阵处评估下表中列出的特殊功能一种
。
Function |
矩阵A评估函数的语法 |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
For matrix square roots, useSQRTM(A)
反而。对于矩阵指数,哪个exp.m(A)
orfunm(a,@exp)
是更准确的取决于矩阵一种
。
代表的功能Fun
必须有一个具有无限收敛半径的泰勒系列。例外是@日志
,被视为一个特例。参数化功能解释了如何为函数提供额外的参数Fun
如有必要。
f = funm(一个,有趣,选择)
sets the algorithm's parameters to the values in the structure选项
。
下表列出了字段选项
。
场地 |
描述 |
价值 |
---|---|---|
|
显示水平 |
|
|
阻塞梭身形式的耐受性 |
正标量。默认为 |
|
评估泰勒系列对角线块的终止公差 |
正标量。默认为 |
|
最大泰勒系列术语数 |
正整数。默认为 |
|
When computing a logarithm, maximum number of square roots computed in inverse scaling and squaring method. |
正整数。默认为 |
|
Specifies the ordering of the Schur form |
长度矢量 |
f = funm(一个,有趣,选项,p1,p2,...)
通过额外的投入p1,p2,...
到这个功能。
[F,EXITFLAG] = FUNM(...)
返回标量ExitFlag.
描述了退出条件fun
。ExitFlag.
可以具有以下值:
0.
——algorithm was successful.
1
- 一个或多个泰勒系列评估没有收敛,或者在对数的情况下,需要太多的平方根。但是,计算价值F
可能仍然是准确的。
[F,exitflag,output] = funm(...)
returns a structure输出
with the following fields:
场地 |
描述 |
---|---|
|
矢量图 |
|
Cell array for which the |
|
按照的方式订购SCHUR形式 |
|
Reordered Schur form |
If the Schur form is diagonal thenOutput = struct('术语',one(n,1),'ind',{1:n})
。
以下命令计算3×3魔矩阵的矩阵正弦。
f = funm(魔术(3),@sin)f = -0.3850 1.0191 0.0162 0.6179 0.2168 -0.1844 0.4173 -0.5856 0.8185
陈述
S = funm(X,@sin); C = funm(X,@cos);
produce the same results to within roundoff error as
E = EXPM(i * x);c =真实(e);s = imag(e);
在任何一种情况下,结果都满足了s * s + c * c = i
, 在哪里i =眼睛(尺寸(x))
。
计算功能exp.(x) + cos(x)
在一种
一个电话fun
那use
f = funm(a,@ fun_expcos)
在哪里fun_expcos.
是the following function.
函数f = fun_expcos(x,k)%exp + cos的kth导数在x. g = mod(ceil(k / 2),2);如果mod(k,2)f = exp(x)+ sin(x)*( - 1)^ g;否则f = exp(x)+ cos(x)*( - 1)^ g;结尾
T.he algorithmfun
uses is described in[1]。
[1] Davies, P. I. and N. J. Higham, “A Schur-Parlett algorithm for computing matrix functions,”SIAM J. Matrix Anal. Appl.,卷。25,2,PP。464-485,2003。
[2] Golub,G. H.和C. F.范贷款,矩阵计算那T.hird Edition, Johns Hopkins University Press, 1996, p. 384.
[3] Moler,C. B.和C. F. F.范贷款,“十九个可疑的方式来计算矩阵的指数,二十五年后”SIAM Review 20,卷。45,第1页,第1页,第1-47,2003。