Fsolve or solve function problem
Mostra commenti meno recenti
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 Commenti
Torsten
il 27 Giu 2019
XX will depend on the symbolic variable a_i.
So it's not possible for a solver to decide whether
XX/L_iso > (1 + eps_m0) or
XX/L_iso <= (1 + eps_m0)
To get a value XX for which FUN(XX) = 0, you will have to give a numerical value to a_i.
Matt J
il 27 Giu 2019
Why use sym variables at all? I see no benefit to them in this case. Just replace them with regular variables.
David André Gomez Romero
il 27 Giu 2019
David André Gomez Romero
il 28 Giu 2019
Risposte (0)
Categorie
Scopri di più su Common Operations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!