![]() ![]() Since we know that we always call it with the same tgm and fgm, let us create the griddedInterpolant on our side, and then pass it to the function as an argument. If you open the code of this function, you will find that it makes a lot of things to parse your inputs, then it creates a griddedInterpolant, and then it interpolates. When I run your code with a profiler, it takes 460 seconds, where 396 seconds are spent for interp1, 2808319 calls, that is 141 ms per 1000 calls. Surprisingly, but the problem is not in load. I'm pretty new to using Matlab's Optimization Toolbox so I'm not entirely sure if I'm approaching this problem correctly, or if I should code the white noise differently or input it in a different place. The ODE: function dz = sdof(t,z,para,tgm,fgm) = sdof(t,z,para,tgm,fgm),, z0,options) The objective function and loading the discrete input: function cost = objfunc(para) Note that this is just an illustrative example of a problem I'm experiencing with a more complicated ODE, that is, even with the complicated ODE, having a sinusoidal input the optimal value is found relatively quickly.įirst let's generate the white noise input and save it into an. When using a sinusoidal input, fmincon finds the optimal value relatively quickly. ![]() The issue I am having is that fmincon takes a very long time to find the optimal value when using a white noise input. The cost function is taken to be absolute maximum displacement of the mass, that is, $\max_\limits(|x(t)|)$. Where $f(t)$ is taken to be constant amplitude white noise. I am trying to use Matlab's fmincon function to find the optimal value of $k$ for the following ODE, which represents a mass-spring system, ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |