New to Matlab - need help with rearranging equation

4 次查看(过去 30 天)
I have the following equation that I would like to rearrange so that "q" is the subject
w = (0-((p*10)-1000*q^(n-1))/((x-1)*q^(n-1)+((1-q^n)/(1-q))))*((c/100) + 1)
Can this be done in Matlab?
I have tired the following:
syms p q n x c w
eqn=((0-((0*10)-1000*q^(n-1))/((x-1)*q^(n-1)+((1-q^n)/(1-q))))*((c/100) + 1)-w==0)
eqn = rewrite(eqn,'log');
solq = solve(eqn, q, 'IgnoreAnalyticConstraints',1)
However this returns an error:
Warning: Unable to find explicit solution. For options, see help.

回答(2 个)

John D'Errico
John D'Errico 2020-10-16
编辑:John D'Errico 2020-10-16
There was NO error returned. It was a WARNING, that while you want to find a solution, none could be found. There are many things in life we may want, but just wanting is not enough to insure something will exist.
In fact, it is pretty easy to show that for general unknown values of the parameters, especially n, no explicit solution interms of radicals will exist as an algebraic expression.
So no, MATLAB cannot solve that problem. But then, neither can any other tool. You cannot solve what is impossible to solve. In fact, it is amazingly easy to write an expression for which no solution can exist. You just did.
If you KNOW numerical values for all of the parameters, thus p,n,x,c,w, then you can supply them, and use a numerical solver. This would be either vpasolve or fzero, although fsolve could also be used. fzero or vpasolve would be better choices.

Jesús Zambrano
Jesús Zambrano 2020-10-16
Hi Philip,
You are right with your approach. I'm afraid there is not explicit solution of this equation for 'q'.

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

标签

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by