Optimize a group of parameters to minimize the delay which is constrained by a second-oder ODE, PLEASE HELP!

2 visualizaciones (últimos 30 días)
The problem is detailed in the attachment.
In short, I have a second-order ODE. No closed form solution can be found. Unfortunately, the objective function I need to optimize IS depending on the solution of the ODE. In addition, there are also some other equations/inequalities which set more constraints. The good side is there equations/inequalities are analytically given. How should I opmtimize this problem? Which Matlab function should I use? Please help. Thanks a lot!

Respuesta aceptada

Alan Weiss
Alan Weiss el 9 de Jun. de 2015
Editada: Alan Weiss el 9 de Jun. de 2015
Without reading your problem, perhaps you can find some help in this example and in this information.
In short, I would try to use fmincon or fminunc to do the optimization, but would carefully try to choose an appropriate value of 'FinDiffRelStep' or 'DiffMinChange'.
And if you need to pass extra parameters to the optimization, see Passing Extra Parameters.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
  6 comentarios
Chuang Qian
Chuang Qian el 22 de Jun. de 2015
Editada: Chuang Qian el 22 de Jun. de 2015
First of all, I should thank you for the suggestion. Things are close to work, but not exactly there yet.
I tried both 'fmincon' and 'patternsearch'. Both seemed running, but neither honored the constraint 'ceq'. I wished the error of 'ceq' to be within 1e-18,and I set 'TolCon' to 1e-19. But both 'patternsearch' and 'fmincon' gave ceq(x_opt) to about 1e-16, which was way too high. Any suggestions to improve this? Thanks a lot!
Alan Weiss
Alan Weiss el 8 de Jul. de 2015
Your problem most likely needs to be rescaled. In floating point arithmetic, the relative error of a calculation can be no better than about 2e-16, and is often worse. So if you are talking about a relative error of 1e-18, then you are out of luck using floating point arithmetic.
But if you need your absolute error to be smaller than 1e-18, then you need to scale your problem so that this absolute error corresponds to a relative error of 1e-12 or so. In other words, multiply your ceq function by 1e6 or some such thing. You might need to rerun your optimization after it finishes.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

Iniciar sesión para comentar.

Más respuestas (1)

RahulTandon
RahulTandon el 6 de Jul. de 2015
%%declarations , you can change here
syms Y em b k E A t gzero gd k Fa Vdd clear;
em = 1.23e-16;
b = 0; % for simplicity
E = 8.85e-12;
A = 1e-12;
gd = 5e-9;
Fa = 1.8e-9;
Vdd = 1; % for ease!!
gzero = 1; %%???!!!
k = 0.363; %%ha ha !
clc;
%% symbolic evaluation Eqn1 = 'em*D2Y+b*DY+k*Y == (E*A/(2*(gzero-Y)))*(Vdd+(Y*(k*gd-Fa)*(gzero-gd)^2)^(1/2))^2'; Eqn2 = 'Y(0) == 0'; Eqn3 = 'DY(0) == 0'; % Y = dsolve(Eqn1,Eqn2,Eqn3); % did not solve on m PC, i shud try parallel % pooling etc. %% next, get the function handle M = matlabFunction(em*diff(Y,t,2)+b*diff(Y,t)+k*Y - (E*A/(2*(gzero-Y)))*(Vdd+(Y*(k*gd-Fa)*(gzero-gd)^2)^(1/2))^2,'vars',{'t' 'Y'});
%% third, , grafical/numerical evaluation clc; [T,Y] = ode45(M,[-10 10],[0 0]); clf; plot(T,Y);

Categorías

Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by