フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

'z' variable appears in my symbolic solution in cubic form (without any RootOf) when using 'solve'

1 回表示 (過去 30 日間)
arianne bercowsky
arianne bercowsky 2017 年 5 月 11 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I am trying to obtain the fixed points of 3 differential equations using the symbolics, and once I have the equations for each fixed point, I want to try different values of the parameters to see for which of them the fixed points remain positive. The code is below and if you run it, you will see that in the solutions form the "solve" I get my symbolics plus a new one that I do not use that is the "z" which appears in a cubic form. The problem is that I do not know where does this come from so I do not know how to deal with this, since I can not use the symbolic form to see if those parameter values are working.
Thank you very much!
% code
syms w n b alpha_w alpha_n1 alpha_n2 alpha_b1 alpha_b2
Parameters = {};
for i = 0.1:0.1:2
for j = 0.1:0.1:2
for k = 0.1:0.1:2
for l = 0.1:0.1:2
for m = 0.1:0.1:2
syms w n b alpha_w alpha_n1 alpha_n2 alpha_b1 alpha_b2
[w, n, b] = solve(w == ((alpha_w*b)/(1+b)), n == ((alpha_n1*w)/(1+w))+((alpha_n2*n)/(1+n)), b == ((alpha_b1*n)/(1+n))+((alpha_b2*w)/(1+w)));
fw = symfun(w, [alpha_w, alpha_n1, alpha_n2, alpha_b1, alpha_b2]);
fb = symfun(b, [alpha_w, alpha_n1, alpha_n2, alpha_b1, alpha_b2]);
fn = symfun(n, [alpha_w, alpha_n1, alpha_n2, alpha_b1, alpha_b2]);
if fw(i,j,k,l,m) > 0 && fb(i,j,k,l,m) > 0 && fn(i,j,k,l,m) > 0
Parameters = {'alpha_w=%d, alpha_n1=%d, alpha_n2=%d, alpha_b1=%d, alpha_b2=%d',i,j,k,l,m};
end
end
end
end
end
end

回答 (1 件)

Megha Parthasarathy
Megha Parthasarathy 2017 年 5 月 16 日
編集済み: Walter Roberson 2017 年 5 月 16 日
Hello,
You may specify the 'MaxDegee" option as 3 in the "solve" function. When we solve a higher order polynomial equation, the solver might use "RootOf" to return the results.
To get an explicit solution for such equations, we need to call the solver with 'MaxDegree' argument set to 3. This option specifies the maximum degree of polynomials for which the solver tries to return explicit solutions. The default value is 2. By increasing this value, you can get explicit solutions for higher order polynomials.
Refer to the following code to obtain y in terms of x and c :
clear all
close all
clc
syms x y c;
sol=solve(x*(c - y)^3 - y == 0, y, 'MaxDegree', 3)
Refer to the following documentation for more details:
You can further simplify the resulting expressions using:
simplify(sol,'Steps',100)
Hope this helps.
Megha

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by