2015-12-27 75 views
2

比方說,我有一個函數,它接受一個實數X並返回一個矩陣M(x)的。我如何評估以下內容?如何在Matlab中集成矩陣函數?

enter image description here

作爲一個例子,我試圖集成功能由下式給出: -

enter image description here

這裏,ķ是常數,是一個矩陣。

我嘗試使用int功能,但它似乎只對標量函數工作。我是Matlab新手。有人可以幫我嗎?

+0

請,提供一個例子M(x)的 – brainkz

+0

你做numericaly,如http://www.mathworks.com/help/matlab/ref/integral.html –

+3

如果你有一個矩陣,那麼你融入每個元素本身,使用一個鏈接 –

回答

1

Matlab的(最新的,2015年)提供了integral功能的功能

numericaly計算積分,對於具有多維域功能(例如矩陣值函數),你可以使用'ArrayValued',true選項

向量值函數

創建矢量值函數

f(x) = [sin x, sin 2x, sin 3x, sin 4x, sin 5x]

並從x=0 to x=1整合。指定'ArrayValued',true至 評估數組值或向量值函數的積分。

fun = @(x)sin((1:5)*x); 
q = integral(fun,0,1,'ArrayValued',true) 

Q =

0.4597 0.7081 0.6633 0.4134 0.1433 

或者,您也可以整合使用循環矩陣值函數逐元素,即每個元素,再加上,一個也可以嘗試vectorize the operation到一個沒有-loops(例如參見here

相關question on scicomp.se