Matlab的一种特殊的一维约束优化 [英] Special kind of 1d constrained optimization with Matlab

查看:94
本文介绍了Matlab的一种特殊的一维约束优化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用Matlab解决以下优化问题:t >= 0时将f(t)最小化.

I would like to solve the following optimization problem with Matlab: minimize f(t) when t >= 0.

fseminf函数,但是我不太了解如何将其应用于我的案例.对于如此看似简单的问题,使用如此强大的工具似乎也有些过头.我将不胜感激有关如何在此处应用fseminf的任何提示,以及任何其他可以解决该问题的建议.

There's fseminf function but i didn't understand well how to apply it to my case. Also it seems a bit overkill to use such a powerful tool for such a seemingly easy problem. I'll be grateful for any tips on how to apply fseminf here and any suggestions how else it can be solved.

推荐答案

Matlab是一种数值软件,因此解决此问题的一种简单"方法是针对t>0的值计算f(t)的值,然后找到最小的.根据功能的不同,您要评估的t的数量可能会更小或更大.

Matlab is a numerical software so one 'simple' way to solve this problem is to calculate the value of f(t) for values of t>0 and then find the minimum of that. Depending on the function the number of ts that you want to evaluate might be smaller or larger.

一种可能的解决方案可能是:

One possible solution could be:

t = 0:0.001:10; % create values from 0 to 10 in steps of 0.001
f = t.^3+5; % evaluate the function for each value of 't'
[minF, locT] = min(f);
minF % this is the smallest value of the function
t(locT) % the minimum value occurred at this 't'

您应该将t定义为期望最小值的区域,如果定义不正确,则只会找到局部最小值.如果单独的"t"之间的间隔太大,则它们之间的最小值也可能会落在这之间,这就是为什么我选择相对较小的"0.001"步长.

You should define t to be in the region where you expect the minimum to, if you define it wrong this would only find the local minimum. If the spacing between separate 't's is too large the minimum might also fall between them, that is why I choose a relatively small step of '0.001'.

这篇关于Matlab的一种特殊的一维约束优化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆