How to minimize [sum of four equations] when I have their differential equations with two variables
2 ビュー (過去 30 日間)
古いコメントを表示
Hello, I'm trying to solve four differential equations. Each differential equation has two variables a and b (not x). My goal is finding out the values of variables( a and b) when [sum of four equations] is minimum using fmincon. The ranges for a and b are 0<a<100 and 0<b<22. So I set up sumofthem=y(1)+y(2)+y(3)+y(4) and fmincon(@sumofthem,[].....). But actually in 'sumofthem', there is no term about a and b so I couldn't put the conditions(such as UB)about a and b in fmincon. Moreover, I don't know how to vary a and b to solve differential equations, not to put individual numbers for them. Does anyone give me an advice? Thank you!
0 件のコメント
採用された回答
Jason Nicholson
2014 年 6 月 17 日
編集済み: Jason Nicholson
2014 年 6 月 17 日
This is a prime candidate for "grey box" modeling with the "System Identification Toolbox" which has a nice GUI.
If you want to use fmincon use the following:
ab0 = [1; 1]; % initial guess
A = [ 1 0; % a<100
-1 0; % a>0
0 1; % b<22
0 -1];% b>0
b = [100*(1-eps); % a<100
0-eps; % a>0
22*(1-eps); % b<22
0-eps]; % b>0
ab = fimcon(@sumOfThem, ab0, A, b);
a = ab(1);
b = ab(2);
4 件のコメント
Jason Nicholson
2014 年 6 月 18 日
編集済み: Jason Nicholson
2014 年 6 月 18 日
Your requirements were the following
0 < a < 100
0 < b < 22.
If they were
0<= a <= 100
0<= b <= 22,
then I would have not used eps.
100*(1-eps) is the number closest to 100 but still less that can be represented by a double. Using this form lets a, for instance, get really close to 100 but it will never equal 100.
In general, this is a small difference. It really doesn't matter most of the time.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!