Optimization Error for car model

2 views (last 30 days)
Wei Kang Chang
Wei Kang Chang on 19 Mar 2019
Answered: Swarooph on 26 Mar 2019
Dear All,
I am trying to optimised a few parameters to achieve minimum fuel consumption. My parameters include gear ratio, throttle, vehicle and driver mass and it must be within a speed limit of 40km/h.
However, when I tried to optimised those parameters, it showed matrix dimensions must agree and failure in initial nonlinear constraint function evaluation. I tried to search online but I cannot figured out what problem is that.
It would be great if someone can tell me what is wrong with my model.
Thank you very much.
Wei Kang Chang
Wei Kang Chang
Wei Kang Chang on 20 Mar 2019
Hi Swarooph,
Thank you for your reply. I have got the same result. And yeah I forgot to attach the FCmin file.

Sign in to comment.

Answers (1)

Swarooph on 26 Mar 2019
The following seems to fix your problem but I don’t know if this is what you really wanted to do:
  • Set FCMin to “Minimize the function output”. Originally it was set to be “Constrain function output to be <= 0”. Did you mean to constrain FCMin to be <=0 ? Does that make sense for the variable/function you are trying to optimize for which seems to be fuel consumption?
  • Once I do (1), I am able to run the optimization without issues. Note that I did terminate the optimization before it converged or terminated automatically just to show that it is able to run iterations and do optimization.
That fixes your error issue. But to be honest, I am not completely convinced you have set up this optimization problem correctly. At the very least, your speed profile needs to have a lower bound of zero so that the car doesn’t go backwards. I also don’t know if you are plotting the right value for fuel consumption cost (FCMin plot). Should it be an average metric? So, take mean of all the fuel consumption values over the drive cycle instead of an array of fuel consumption values? Just some thoughts for you to think about.


Find more on Vehicle Scenarios in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by