Combining ode45 and optimization solvers
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I am strugging to solve ode45 with an optimization paramter that is time varying. Let's take an example
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/565226/image.png)
where
is known vector and x is scalar (assume
). To solve the system by ode45, I will need to use interp1 command because
varies with time. The output of the ode45 will be a vector which includes the solution of the ode. With that being said, I want to find the optimal
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/565231/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/565236/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/565241/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/565246/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/565251/image.png)
such that it is almost the same as u. My objective function will be
. But when I use interp1 command, it does not work because
will not be double type. If I use for example cvx toolbox,
will be cvx type and not double !!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/565256/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/565246/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/565246/image.png)
How can I fix this?
2 个评论
Star Strider
2021-3-28
What sort of optimisation do you want to do?
Do any of the MATLAB Toolboxes (Such as the Optimization Toolbox or Global Optimization Toolbox) have the functions that perform that sort of optimisation?
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!