필터 지우기
필터 지우기

Multivariate Nonlinear Problem With vector & matrix unknown inputs

조회 수: 1 (최근 30일)
Ahmed Ghamdi
Ahmed Ghamdi 2019년 9월 21일
댓글: Matt J 2019년 9월 27일
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,

채택된 답변

Matt J
Matt J 2019년 9월 21일
편집: Matt J 2019년 9월 21일
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
Ahmed Ghamdi
Ahmed Ghamdi 2019년 9월 27일
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 2019년 9월 27일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by