最小化包含积分的函数

发布于 2024-08-21 13:04:38 字数 270 浏览 7 评论 0原文

有谁知道如何在 MATLAB 中最小化包含积分的函数?该函数如下所示:

L = Int(t=0,t=T)[(AR-x)dt], A is a system parameter and R and x are related through:  
dR/dt = axRY - bR, where a and b are constants.  
dY/dt = -xRY

我在某处读到可以组合使用 fminbnd 和quad,但我无法使其工作。有什么建议吗?

Does anyone know how to minimize a function containing an integral in MATLAB? The function looks like this:

L = Int(t=0,t=T)[(AR-x)dt], A is a system parameter and R and x are related through:  
dR/dt = axRY - bR, where a and b are constants.  
dY/dt = -xRY

I read somewhere that I can use fminbnd and quad in combination but I am not able to make it work. Any suggestions?

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

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

发布评论

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

评论(3

画中仙 2024-08-28 13:04:38

也许您可以提供积分的更多详细信息,例如 [AR-x)dt] 中缺少的括号在哪里? x 是否依赖于 t,或者我们可以整合 dR/dt = axR - bR 得到 R=C* exp((a*xb)*t)?无论如何,要回答有关 fminbndquad 的问题,您可以设置 A,C,T,a,b,xmin 和 < code>xmax (最后两个是您要查找最小值的范围)并使用:

 [x fval] = fminbnd(@(x) quad(@(t)A*C*exp((a*x-b)*t)-x,0,T),xmin,xmax)

这将找到使积分最小化的 x

Perhaps you could give more details of your integral, e.g. where is the missing bracket in [AR-x)dt]? Is there any dependence of x on t, or can we integrate dR/dt = axR - bR to give R=C*exp((a*x-b)*t)? In any case, to answer your question on fminbnd and quad, you could set A,C,T,a,b,xmin and xmax (the last two are the range you want to look for the min over) and use:

 [x fval] = fminbnd(@(x) quad(@(t)A*C*exp((a*x-b)*t)-x,0,T),xmin,xmax)

This finds x that minimizes the integral.

你与清晨阳光 2024-08-28 13:04:38

如果我没有理解错的话,你正试图最小化对 t 的尊重:

\int_0^t{(AR-x) dt}

那么你只需要找到以下的零:

AR-x

这只是数学,而不是 matlab ;)

If i didn't get it wrong you are trying to minimize respect to t:

\int_0^t{(AR-x) dt}

well then you just need to find the zeros of:

AR-x

This is just math, not matlab ;)

三月梨花 2024-08-28 13:04:38

以下是对方程的一些处理,可能会有所帮助。

结合你给出的第二个和第三个方程,

dR/dt = -a*(dY/dt)-bR

现在如果我们求解右侧的 R 并将其代入你给出的第一个方程,我们得到

L = Int(t=0,t=T)[(-A/b*(dR/dt + a*dY/dt) - x)dt]

现在我们可以对第一项进行积分,得到:

L = -A/b*[R(T) - R(0) + Y(T) - Y(0)] - Int(t=0,t=T)[(x)dt]

所以现在所有关于 R 和Y 是端点。事实上,您也可以定义一个新函数 Z,它等于 Y + R。然后您会得到

L = -A/b*[Z(T) - Z(0)] - Int(t=0,t=T)[(x)dt]

下一部分,我对此不太有信心。x 相对于 t 的积分将给出一些在 t 处计算的函数= 0 且 t = T。我们将调用该函数 X 来给出:

L = -A/b*[Z(T) - Z(0)] - X(T) + X(0)

该方程对于所有 T 都成立,因此如果愿意,我们可以将 T 设置为 t。

L = -A/b*[Z(t) - Z(0)] - X(t) + X(0)

另外,我们可以将很多常量组合在一起,并将它们称为 C 来给出

X(t) = -A/b*Z(t) + C

where

C = A/b*Z(0) + X(0) - L

所以我不确定还能做什么,但我已经证明 x(t) 的积分与 Z( t) = R(t) + Y(t)。在我看来,有很多方程可以解决这个问题。还有人知道从这里该去哪里吗?我的数学有问题吗?

Here's some manipulation of your equations that might help.

Combining the second and third equations you gave gives

dR/dt = -a*(dY/dt)-bR

Now if we solve for R on the righthand side and plug it into the first equation you gave we get

L = Int(t=0,t=T)[(-A/b*(dR/dt + a*dY/dt) - x)dt]

Now we can integrate the first term to get:

L = -A/b*[R(T) - R(0) + Y(T) - Y(0)] - Int(t=0,t=T)[(x)dt]

So now all that matters with regards to R and Y are the endpoints. In fact, you may as well define a new function, Z which equals Y + R. Then you get

L = -A/b*[Z(T) - Z(0)] - Int(t=0,t=T)[(x)dt]

This next part I'm not as confident in. The integral of x with respect to t will give some function which is evaluated at t = 0 and t = T. This function we will call X to give:

L = -A/b*[Z(T) - Z(0)] - X(T) + X(0)

This equation holds true for all T, so we can set T to t if we want to.

L = -A/b*[Z(t) - Z(0)] - X(t) + X(0)

Also, we can group a lot of the constants together and call them C to give

X(t) = -A/b*Z(t) + C

where

C = A/b*Z(0) + X(0) - L

So I'm not sure what else to do with this, but I've shown that the integral of x(t) is linearly related to Z(t) = R(t) + Y(t). It seems to me that there are many equations that solve this. Anyone else see where to go from here? Any problems with my math?

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