Fsolve or solve function problem

조회 수: 2 (최근 30일)
David André Gomez Romero
David André Gomez Romero 2019년 6월 27일
댓글: David André Gomez Romero 2019년 6월 28일
Hello,
I want to resolve a function with fsolve which my only variable is XX :
---------------------------------------------------------------------
FUN = @(XX) Force_SE(XX, LTendon_slack_i, L_totale, Angle_Pen_i) - Force_PE(XX,F_iso_max_i, L_iso)*cos(Angle_Pen_i);
---------------------------------------------------------------------
This function containt two other function (Force_SE, Force_PE) which are constraint according to the value of XX, for exemple in Force_SE (parameters like eps_m0, k_PE, .. are double value defined previously) :
---------------------------------------------------------------------
Fiber_length_normalized = XX/L_iso;
if (Fiber_length_normalized > (1 + eps_m0) )
F_passive_i = F_iso_max_i*(1 + (k_PE/eps_m0)*(Fiber_length_normalized - (1+eps_m0)));
elseif (Fiber_length_normalized <= (1 + eps_m0) )
F_passive_i = F_iso_max_i*exp(k_PE*(Fiber_length_normalized - 1)/eps_m0)/exp(k_PE);
else
fprintf('Problem active Force')
end
---------------------------------------------------------------------
The problem is that Force_PE contains a symbolique value a_i (F_passive_i, F_iso_max_i, gamma, are double value previously defined)
---------------------------------------------------------------------
cst = exp(-(Fiber_length_normalized-1)^2/gamma);
syms a_i;
F_Active_i = a_i*F_iso_max_i*cst;
F_Paral_elem = F_passive_i + F_Active_i;
---------------------------------------------------------------------
If I understand well FSOLVE will never give me a solution containing a sym value. Then I was thinking to resolve it with the function SOLVE but with this function how the constraint will be respected ? If we use SOLVE, my variable is a sym-value, then in the IF-loop of the constraint an error will appear because we can not compare a double to a sym.... I have the code well define if asked I can send it.
Thanks in advance for the help.
  댓글 수: 4
David André Gomez Romero
David André Gomez Romero 2019년 6월 27일
Matt J, you are completelty right, I can use instead of a sym also a regular variable. The only thing, it is that at this moment of the code I don't want to find a solution for a_i. This variable has to be found quite later in the code with an optimization (FMINCON), this is why I wanted to put a symbolique value.
In fact, it would be great if I can obtain a function for XX depending of 'a_i' --> XX(a_i). And that's why I want use the function SOLVE found an expression which i can fit in my optimization inovlinvg FMINCON. But still, it remains some problems :
  • I really don't know how to write XX as a function of 'a_i' using for exemple SOLVE due to the fact that we have in the expression of Force_SE and Force_PE condition on XX. (if i did not have some constraint on the function the problem will be quite easy and could use simply SOLVE to find an expression of XX function of 'a_i' which I can use later on the FMINCON optimization as another constraint).
Thanks for the answer.
David André Gomez Romero
David André Gomez Romero 2019년 6월 28일
If someone is interested on the solution for my problem, finally I think to use the function : PIECEWISE.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Surrogate Optimization에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by