Effacer les filtres
Effacer les filtres

Multivariate Nonlinear Problem With vector & matrix unknown inputs

1 vue (au cours des 30 derniers jours)
Ahmed Ghamdi
Ahmed Ghamdi le 21 Sep 2019
Commenté : Matt J le 27 Sep 2019
Hello,
Problem description:
I have oil flow rate observed (qo_obs) and I have a model to calculate oil flow rate (qo_cal).
The model to find qo_cal is somewhat complex, and it invloved three unknowns: f, tau, and V.
f is a 9x16 matrix, tau is a 9x1 vector, V is a 9x1 vector.
each of the unkowns above has its own constraints, such as:
Sum of every column of f = 1, (How do I even write this constraint?)
any tau >0
0< V<C, where C is some constant I know.
Now I want to find the values of these unkowns that will yield minimum of (qo_obs-qo_cal)^2
What solver to use? and how?
Thanks,

Réponse acceptée

Matt J
Matt J le 21 Sep 2019
Modifié(e) : Matt J le 21 Sep 2019
It's very easy to set up all the variables and constraints with the problem-based approach.
f=optimvar('f',[9,16]);
tau=optimvar('tau',[9,1],'LowerBound',zeros(9,1));
V=optimvar('V',[9,1],'LowerBound',0,'UpperBound',C);
prob=optimproblem('ObjectiveSense','minimize');
prob.Constraints.fconstraint=sum(f)==1;
prob.Objective=_____________
Once you've defined your objective, just do
sol=solve(prob)
  14 commentaires
Ahmed Ghamdi
Ahmed Ghamdi le 27 Sep 2019
Thanks Matt,
my code is working fine, but fmincon takes 7 hours to run. Is this normal? Also, are there more advanced algorathims better than fmincon?
Matt J
Matt J le 27 Sep 2019
There is no normal. It depends in part on how much time it takes to execute your Objective function code. I see in your code that you have done no vectorization at all - everything is done with for-loops. It is plausible to me that that would make execution time very long.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by