如何对需要先进行矩阵计算的函数进行积分?

发布于 2024-11-30 14:57:41 字数 320 浏览 4 评论 0原文

我现在正在做论文。我坚持使用积分。我的函数定义为

myfun =(exp(t*Q)*V*x)(j);

其中 QV 是矩阵 (n*n),x 是一个元素为 1 的向量,经过计算我们得到该向量的第 j_ 个元素,然后我需要对 t 进行积分。

我想在matlab中使用quad。然而,重点是它会报告内部矩阵的大小不同。由于这里的 A 不是数字?...

我该怎么做。否则我只能针对 t 本身编写一个循环,这非常慢。

谢谢

I am doing my dissertation now. I stuck with a integral. My function is defined as

myfun =(exp(t*Q)*V*x)(j);

where Q and V are a matrix (n*n), x is a vector which elements are 1, then after calculation we get the j_th element of that vector then I need to integrate the function against t.

I want to use the quad in the matlab. However the point is that it will report the inner matrix is not the same size. Since A here is not a number ?....

How can I do this. Otherwise I could only write a loop against t itself, which is extremely slow.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青春如此纠结 2024-12-07 14:57:41

您可以使用 SUBSREF (您仍然需要循环所有 < code>j's,不过):

 myfunOfT = @(t)(subsref(exp(t*Q)*V*x,struct('type','()','subs',j);

这将返回数组在时间 t 的第 j 元素的值。

You can use SUBSREF for this (you still neet to loop over all j's, though):

 myfunOfT = @(t)(subsref(exp(t*Q)*V*x,struct('type','()','subs',j);

This returns the value of the jth element of the array at time t.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文