Minimization Algorithm (fmincon)
3 次查看(过去 30 天)
显示 更早的评论
I am trying to set up a minimization code using the function fmincon. My code describes a chemical reactor, which receives a series of temperatures and molar fractions as input data (lines 44-149 in the Matlab code, if "clearvars" is line 1). In particular, I have carried out 20 experiments, each of whose has been analyzed at 9 diverse temperatures (220, 240, 260, 280, 300, 320, 340, 360, 380 °C): the molar fractions getting out of the reactor (180 for each species, i.e. 9*20, lines 151-178) have to be compared to the ones predicted by the model. I need to find four parameters (k0_alpha3, k0_K_CO, Eapp_alpha3, DH_K_CO) so that the difference between the predicted and the measured CH4 molar fractions (yCH4out_model and yCH4out, respectively) is minimum. The code I have implemented runs, but it is strongly affected by the initial-guess values and seems not to minimize the aforementioned quantity at all. I have also plotted the predicted values vs the measured ones for each experiment (20 plots) with respect to temperature and a clear difference is observable: a manual modification of the parameters can simply enhance my results, wich means that there might be something "fishy" in my code. What can I do to improve my results? The file of interest has been attached.
Thanks in advance, Riccardo Rinaldi
2 个评论
采纳的回答
Alan Weiss
2018-10-19
After reading your code I decided that, based on the suggestions in Optimizing a Simulation or ODE, it might be better to take larger finite difference steps, so I set 'FiniteDifferenceStepSize',1e-4 in the options. The resulting Fval was reduced quite a bit, but the plots did not look so close to me. Then I tried 'FiniteDifferenceStepSize',1e-3,'FiniteDifferenceType','central', and again the resulting Fval was reduced quite a bit (down to 2.57e-2) but the plots still did not match very well.
It is possible that, like many least-squares problems, you must start from a wide variety of initial points to get a global minimum. See MultiStart using lsqcurvefit or lsqnonlin for a discussion.
I can also suggest that it might be better to scale your problem so that each coordinate has about the same range. This essentially means taking different units for some coordinates, so that the problem does not have such disparate sizes in the different coordinates.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!