I have a big Simulink model. I want to find the input to the system (which is a time series) that will maximize the output (which is another time series, like any other Simulink model).
Which command or toolbox should I use and how? Optimization toolbox, Neural networks, Fuzzy, Genetic algorithm?
Hi,
as Mariano was suggesting you may consider using an optimization algorithm and run the Simulink model in your objective function. You can use the SIM command to run the simulation from the code with your different input vector. To understand what's the appropriate optimization function you need to consider which type of problem you are solving (as previously suggested FMINCON and FMINUNC are good starting points).
You may also consider using Simulink Parameter Estimation (offered in Simulink Design Optimization) to setup the optimization process directly in Simulink (although if you're extensively working with timeseries you may find it quicker to write all the code in MATLAB for your optimization routine).
Thank you, your answer was really useful, it should work. Now, I have another problem, this time in using 'fmincon'. This is my question:
http://www.mathworks.com/matlabcentral/answers/47017-help-with-fmincon-optimization
Would you please help me on this one too? tnx
And, I have a third question:
How can I pass an input to my Simulink model when using 'sim' command? Currently, I'm declaring a global variable to pass the input through a Workspace variable.
6 Comments
Direct link to this comment:
http://www.mathworks.de/matlabcentral/answers/46404#comment_95438
depends on your model system?i think the problem have nothing to do with simulink
Direct link to this comment:
http://www.mathworks.de/matlabcentral/answers/46404#comment_95799
The concept of maximizing a time series makes no sense what so ever.
What do you really want to do?
Direct link to this comment:
http://www.mathworks.de/matlabcentral/answers/46404#comment_96168
OK, I think I have to be more precise. Imagine a Simulink model. It's a vehicle model. I want to find the steer angle (input) as a function of time which maximizes vehicle body's roll angle over a 5 sec period. What should I exactly do?
I will really appreciate it if anyone helps.
Direct link to this comment:
http://www.mathworks.de/matlabcentral/answers/46404#comment_96176
I think you need to post a bit more information. Do you have any constraints on the input or the output? Is it safe to assume the model will be operating in a linear range and therefore use a linear model?
Try looking at the documentation for the function fmincon (if you have constraints) or fminunc (if you do not have constraints) and see if that could solve your problem.
Direct link to this comment:
http://www.mathworks.de/matlabcentral/answers/46404#comment_96296
I don't understand the question. If you have an input it must have limits. If you max out the control input that affects roll you will get the maximum roll rate.
It sounds like what you really want is a control system.
Direct link to this comment:
http://www.mathworks.de/matlabcentral/answers/46404#comment_96726
Dear Mariano, The parameter 'fun' in the syntax x = fmincon(fun,x0,A,b) is a Simulink model in my case. I've searched a bit more and I've come to some conclusions. I hope it works.
Dear Ryan, No the dynamics is highly nonlinear and is not simple such that when you apply the maximum steer, the vehicle roll most; actually some really harsh steering input such as an evasive maneuver is required to induce rollover.
Thanks for your answers