# approaching goal attaining optimization problem

1 ビュー (過去 30 日間)
Chandra Sekhar Kommineni 2022 年 1 月 13 日
I have a equation, I'm trying to aim for certrain fixed output but I have single equation and two variables to change. i'm trying achieve fixed sigma value. L0, t01 are optimized output values for fixed sigma values. I have no clue, how to approach this problem, I tried few things but they did't work out. Could someone help me with my problem? Thank you in advance.
%Below Rt and N are user defined
%T is fixed as well
% L0 upperbound 200
%t01 upperbound 28
j = sym('j');
Area= eval((L0*t01*symsum((4^(j+1))*((0.5)^j)*(Rt^j),j,0,N-1))-((t01^2)*symsum(2^(2*j+1)*(Rt^((2*j)-1)),j,1,N-1))-((t01^2)*symsum(2^(2*j+2)*Rt^(2*j),j,0,N-1)));
Sigma= (Area/T^2)*100;
x0=[200 20];
A = []; Aeq = []; Beq = []; B=[];
options = optimoptions(@fmincon,'Algorithm','trust-region-reflective','TolFun',1e-14,'TolX',1e-14,'MaxFunEvals',10000,'MaxIter',10000,'Display','iter');
lb=[180 20]
ub=[200 28]
sigma
fun = @(L0,t01)(Sigma-(Area/T^2)*100);
[fval1,fval2]=fmincon(@fun,x0,A,B,Aeq,Beq,lb,ub,@confunc)
##### 11 件のコメント表示 10 件の古いコメント非表示 10 件の古いコメント
Chandra Sekhar Kommineni 2022 年 1 月 14 日
I did tweaks to the above code, somewhat I achieved the goal. I added "options" to fgoalattain, its working sometimes, sometimes error is more. Can you please tell whats happening in optimset? is there anything else to improve the code
clc;clear all;
goal=29;
weight=0.0001;
x0=[1.0 1.0 0.1];
lb=[204 18 0.4];
ub=[230 26 0.48];
options = optimset( 'Display' , 'iter' , ...
'GoalsExactAchieve' ,2);
%options = optimoptions(@lsqnonlin,'Algorithm','trust-region-reflective','TolFun',1e-14,'TolX',1e-14,'MaxFunEvals',10000,'MaxIter',10000,'Display','iter');
[x, feval]= fgoalattain(@ (x) myfun (x(1), x(2), x(3)), x0, goal, weight, [], [], [], [],lb,ub,[],options);

サインインしてコメントする。

### カテゴリ

Find more on Solver Outputs and Iterative Display in Help Center and File Exchange

R2021b

### Community Treasure Hunt

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

Start Hunting!