Using VPA solver to find a solution
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I see solving the following algebraic equation using Matlab gives an output in terms of "root(something)". I used a VPA solver to try to find an appropriate solution, but what I have actually obtained still has the part "root". Would you help to find a readable solution rather than the one containing "root(something)"?
Thank you in advance.
syms k_p k_Np k_disso omega W
eqn=(k_Np+k_p+k_disso+i*omega)*((k_Np+k_disso+W+i*omega)*(k_Np+k_p+k_disso+i*omega)-k_p*k_Np)-k_p*k_Np*(k_Np+k_disso+W+i*omega)==0;
sol=solve(eqn,omega)
sol =
root(z^3 - z^2*(W + 3*k_Np + 3*k_disso + 2*k_p)*1i + z*(W*k_Np*2i + W*k_disso*2i + W*k_p*2i + k_Np*k_disso*6i + k_Np*k_p*2i + k_disso*k_p*4i + k_Np^2*3i + k_disso^2*3i + k_p^2*1i)*1i + k_Np*k_disso*k_p*2i + W*k_disso*k_p*2i + W*k_Np*k_p*1i + W*k_Np*k_disso*2i + k_disso^2*k_p*2i + k_disso*k_p^2*1i + k_Np^2*k_disso*3i + k_Np*k_disso^2*3i + W*k_p^2*1i + W*k_disso^2*1i + W*k_Np^2*1i + k_disso^3*1i + k_Np^3*1i, z, 1)
0 commentaires
Réponses (1)
Shivang
le 5 Sep 2023
Hi,
I understand you're trying to solve a symbolic equation, and would like a more explicit answer rather than in the form of 'root' of a polynomial.
The equation you're trying to solve is of degree 3 in the variable 'omega'. You can get an explicit solution for such equations by calling the solver with 'MaxDegree'. The option specifies the maximum degree of polynomials for which the solver tries to return explicit solutions. The default value is 2. Increasing this value, you can get explicit solutions for higher order polynomials.
You can solve the same equation for explicit solutions by increasing the value of 'MaxDegree' to 3.
syms k_p k_Np k_disso omega W
eqn=(k_Np+k_p+k_disso+i*omega)*((k_Np+k_disso+W+i*omega)*(k_Np+k_p+k_disso+i*omega)-k_p*k_Np)-k_p*k_Np*(k_Np+k_disso+W+i*omega)==0;
sol=solve(eqn,omega,'MaxDegree', 3)
As you can see, MATLAB is now able to provide an explicit solution. You can also use 'vpa' on the solution to numerically approximate the symbolic expression.
Hope this helps.
-Shivang
0 commentaires
Voir également
Catégories
En savoir plus sur Calculus dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!