How to solve rachford - race function using newton method

12 vues (au cours des 30 derniers jours)
Ruslan
Ruslan le 25 Nov 2024
Commenté : Ruslan le 26 Nov 2024
I am beginner in MatLab. I don't understand how to define this function. I need to find value of fRg. I have massives with values of ci and Ki.

Réponse acceptée

Torsten
Torsten le 25 Nov 2024
Modifié(e) : Torsten le 25 Nov 2024
Multiply the equation by product_{i=1}^{n_c} (1+f_Rg*(K_i-1)). This gives you a polynomial of degree n_c-1 in f_Rg which can be solved using the "roots" function.
Or if you are lazy, just use:
K = [3 5 -7 9 -10 2];
c = [0.4 0.6 1.2 -0.7 1.1 0.8];
syms f_Rg
fun = sum(c.*(K-1)./(1+f_Rg*(K-1)));
f_Rg_num = double(solve(fun==0,f_Rg))
f_Rg_num =
0.1072 + 0.0000i -0.1606 - 0.0949i -0.1606 + 0.0949i -0.4091 + 0.0000i -0.7971 + 0.0000i
But don't use Newton's method in this case because the equation has nc-1 solutions, and it were pure luck if Newton's method converged to the "correct" one.
  3 commentaires
Torsten
Torsten le 26 Nov 2024
Modifié(e) : Torsten le 26 Nov 2024
Your equation rewritten is a polynomial of degree n_c-1 in the variable f_Rg. A polynomial can have real and complex roots. A value for the "i" component in the solution for f_Rg_num that is different from 0 indicates complex roots. You will have to sort out the "correct" solution for your case from the n_c-1 solutions returned.
Ruslan
Ruslan le 26 Nov 2024
Oh. Now I understand. Thank you. Actual answer is in range from 0 to 1, so it will be easy to sort. Thank you for your help!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by