Solve function has no numerical answer

8 ビュー (過去 30 日間)
chia ching lin
chia ching lin 2022 年 1 月 12 日
回答済み: Star Strider 2022 年 1 月 13 日
i'm trying to solve a simple eqation which has a large answer, but i can't get numerical answer, which keep having an answer of z2^5.
How can I get the numerical answer? vpasovle() has used.
The answer should be 1.24209e17.
Here is my code
lambda0=1.3e-6;
L=1.8e-3;
syms x
A=-6.2*10^(-22);
B=-6*10^(-18);
C=lambda0/(2*L);
eq=A*x+B*x^0.8==C;
anss=solve(eq,x,'ReturnConditions',true);
if not adding 'ReturnCondition', there will have warning
Warning: Solutions are parameterized by the symbols: z2. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
Warning: Solutions are only valid under certain conditions. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
  4 件のコメント
chia ching lin
chia ching lin 2022 年 1 月 13 日
Hi David, thank's for the advice, but I have tried making A and B possible, and make sure x is possible, it turns in the same result, showing x=z2^5.
chia ching lin
chia ching lin 2022 年 1 月 13 日
Hi Star Strider,
I rewrite the equation as eq=x==((C-A*x)/B)^1.25
the code will be
lambda0=1.3e-6;
L=1500e-6;
syms x
A=6.2*10^(-22);
B=6*10^(-18);
C=lambda0/(2*L);
eq=x==((C-A*x)/B)^1.25;
eql=lhs(eq);
eqr=rhs(eq);
fplot([eql eqr],[-1 1]*1e18);
ans1=solve(eq,x);
Warning: Solutions are parameterized by the symbols: z1. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
Warning: Solutions are only valid under certain conditions. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
disp(ans1);
There must have a solution now, but still get the a symbolic result.

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2022 年 1 月 13 日
Try this —
lambda0=1.3e-6;
L=1500e-6;
syms x real
A=6.2*10^(-22);
B=6*10^(-18);
C=lambda0/(2*L);
eq=x==((C-A*x)/B)^1.25;
eql=lhs(eq);
eqr=rhs(eq);
fplot([eql eqr],[-1 1]*1e18);
hold on
Sx = solve(eq,x,'ReturnConditions',true)
Sx = struct with fields:
x: y parameters: y conditions: y^5 + (4693431831132779581738070212006365673936517891122845042577067921739724388119834008196149107853623296*y^4)/57670275975350589509920414660230445392846527400831261243883714189631315570213625 + (14929857697377347584978863881277661458…
Sxc = vpa(Sx.conditions,5)
Sxc = 
ans1=isolate(eq,x)
ans1 = 
vpa_ans1 = vpa(ans1,5)
vpa_ans1 = 
plot(vpa_ans1, 0, '+r', 'MarkerSize',15)
hold off
grid
I cannot imagine that a fifth-degree polynomial has only one root, although since I specified that ‘x’ be considered real, the other 4 polynomial roots (that must exist under some conditions) are all complex or pure imaginary. The real root is the only one that really matters here, anyway.
.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAssumptions についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by