필터 지우기
필터 지우기

unexpected parameter z3 when using solve command

조회 수: 2 (최근 30일)
Seraphic
Seraphic 2023년 1월 31일
댓글: Walter Roberson 2023년 2월 1일
Hi, I am new to matlab and want to solve an eqution.
syms x
eqn = x-((1-1/0.9925)*0.65-0.003)*x^((1/0.66)/(1/0.97))== 20+((1-1/0.9925)*0.65-0.003)*((1/0.97)^(-0.66)*(1-0.97*(1-0.003)-(1-0.97/0.9925)*0.65)^(-0.66));
Then, the following warning pops up.
Warning: Solutions are parameterized by the symbols: z2. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
> In sym/solve>warnIfParams (line 475)
In sym/solve (line 357)
In Untitled (line 4)
Warning: Solutions are only valid under certain conditions. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
> In sym/solve>warnIfParams (line 478)
In sym/solve (line 357)
In Untitled (line 4)
I edited my code and ran again, then unexpected parameter z3 came up.
syms x
eqn = x-((1-1/0.9925)*0.65-0.003)*x^((1/0.66)/(1/0.97))== 20+((1-1/0.9925)*0.65-0.003)*((1/0.97)^(-0.66)*(1-0.97*(1-0.003)-(1-0.97/0.9925)*0.65)^(-0.66));
[solx,parameters,conditions] = solve(eqn,x,'ReturnConditions',true)
assume(conditions);
restriction = [100>solx , -100 <solx ];
solz = solve(restriction,parameters)
valx = subs(solx,parameters,solz)
I don't understand what z3 means here and how to get my solution valx. Even the equation inside the root parenthesis seems illogical. Please help me with this.
solx =
z3^66
parameters =
z3
conditions =
-pi/66 < angle(z3) & angle(z3) <= pi/66 & z3^97 + (576460752303423488*z3^66)/4560864541524069 - 3822084685500913664/1520288180508023 == 0
solz =
root(z^97 + (576460752303423488*z^66)/4560864541524069 - 3822084685500913664/1520288180508023, z, 1)
valx =
root(z^97 + (576460752303423488*z^66)/4560864541524069 - 3822084685500913664/1520288180508023, z, 1)^66

답변 (1개)

Walter Roberson
Walter Roberson 2023년 1월 31일
이동: Walter Roberson 2023년 2월 1일
Should the 0.66 instead be exactly 2/3 ? Should the 0.65 be 2/3 - 1/100 ?
Should the 0.97 be 1 - 0.003*10 ?
Is there a relationship between the 0.97 and the 0.9925 ?
Q = @(v) sym(v);
F = sym(2)/sym(3);
Fm = F - 1/sym(100);
syms x
eqn = x-((1-1/Q(0.9925))*Fm-Q(0.003))*x^((1/F)/(1/Q(0.97))) == 20+((1-1/Q(0.9925))*Fm-Q(0.003))*((1/Q(0.97))^(-F)*(1-Q(0.97)*(1-Q(0.003))-(1-Q(0.97)/Q(0.9925))*Fm)^Q(-F))
eqn = 
%sol = solve(eqn, x, 'returnconditions', true)
vpa(eqn, 10)
ans = 
vpasolve(eqn, 10)
ans = 
19.295781077501889097831548029764
  댓글 수: 3
Walter Roberson
Walter Roberson 2023년 2월 1일
Sure, I show using vpasolve here. The Q() calls are there to convert coefficients to rationals because solve() is intended to find exact closed form solutions whenever possible, and converting to rational reduces floating point round off problems. But most importantly if you want to use solve then you need better precision about exactly what you mean by taking a variable to the power of 0.66

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by