文件

fun

评估常规矩阵函数

句法

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.函数的衍生物Funevaluated atX(i)。乐趣表示的功能必须具有泰勒系列,除了有趣= @log.,被视为一个特例。

你也可以使用fun在矩阵处评估下表中列出的特殊功能一种

Function

矩阵A评估函数的语法

exp.

funm(a,@exp)

日志

funm(a,@log)

fun(A, @sin)

cos

funm(a,@cos)

Sinh.

funm(a,@sinh)

cosh

Funm(A,@cosh)

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选项

下表列出了字段选项

场地

描述

价值

options.display.

显示水平

'off'(默认),'在''verbose'

选项.Tolblk.

阻塞梭身形式的耐受性

正标量。默认为0.。1

options.toltay.

评估泰勒系列对角线块的终止公差

正标量。默认为EPS.

options.maxterms.

最大泰勒系列术语数

正整数。默认为250.

options.maxsqrt.

When computing a logarithm, maximum number of square roots computed in inverse scaling and squaring method.

正整数。默认为10.0.

选项

Specifies the ordering of the Schur formT.

长度矢量长度(a)options.ord(i)是块的索引T(我,我)放置。默认为[]

f = funm(一个,有趣,选项,p1,p2,...)通过额外的投入p1,p2,...到这个功能。

[F,EXITFLAG] = FUNM(...)返回标量ExitFlag.描述了退出条件funExitFlag.可以具有以下值:

  • 0.——algorithm was successful.

  • 1- 一个或多个泰勒系列评估没有收敛,或者在对数的情况下,需要太多的平方根。但是,计算价值F可能仍然是准确的。

[F,exitflag,output] = funm(...)returns a structure输出with the following fields:

场地

描述

output.terms.

矢量图output.terms(i)是评估时使用的泰勒系列术语数量一世在对数的情况下,或者在对数的情况下,大于2的矩阵的平方根的数量。

输出。一世nd

Cell array for which the(I,J)块的重新排序舒尔的因素T.t(output.ind {i},output.ind {j})

输出

按照的方式订购SCHUR形式ordschur.

产出

Reordered Schur form

If the Schur form is diagonal thenOutput = struct('术语',one(n,1),'ind',{1:n})

例子

例1

以下命令计算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

例2.

陈述

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))

例3.

计算功能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;结尾

一种lgorithms

T.he algorithmfunuses is described in[1]

References

[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。

也可以看看

||

Introduced before R2006a

Was this topic helpful?