Fzero question : Error using fzero (line 308) Initial function value must be finite and real.

I tried my equation like below :
fzero(@(x) 20000/x(1-x)*(1+0.1*(1.523*(1-x)/x)^0.75)*0.005093-x(1-x)*9768.4, 0)
I didn`t touch anything with matlab. and I just tried that equation as soon as I opened my matlab program.
so I don`t know why there is an error like that.
please somebody help me... I`m a beginner of matlab.
thanks.

 采纳的回答

Well you have divisions by x in your function, so naturally choosing x0=0 will not give you a finite initial value.
Also, you are missing multiplication signs in x(1-x).

7 个评论

oh my gosh I`m really appreciating your answer and I fixed x(1-x) to x*(1-x) right away.
but I don`t know how I deal with that x0=0. I mean, you know, I absolutely understand what you said. and I don`t know what I fix in your first anwser. Am I wrong because of the fzero function? I mean, Should I use the other function because of that cause(the first sentence)?
Couldn't you select a different initial x0? The root is clearly not near x0=0.
oh you mean, I should change the equation like this?
x = fzero(@(x) 20000/x*(1-x)*(1+0.1*(1.523*(1-x)/x).^0.75)*0.005093-x*(1-x)*9768.4, 0.25)
Well, it does seem to find you a root:
[x,fval] = fzero(@(x) 20000/x*(1-x)*(1+0.1*(1.523*(1-x)/x).^0.75)*0.005093-x*(1-x)*9768.4, 0.25)
x = 0.1282
fval = 0
you mean, I got an answer in that equation?
and that x = 0.1282 is the answer right?
There are solutions at:
x = 1
x = infinity
x = -infinity
and where
219964813000029765632*x^2 - 229368329021979375*(-((1523*x)/1000 - 1523/1000)/x)^(3/4) - 2293683290219793750 == 0
This can be rewritten in terms of roots of a polynomial of degree 11
1198623577502935913088088084852730196833129872468381163324810188073588187284281229312*Z^11 - 49994593834998181651140818644901902039353356982740649636362466773093199957196800000*Z^9 + 781978009914558436529645975825514493802993999597042579585678618992312320000000000*Z^7 - 5436050945900176563164670547797245943390787108203736252765175808000000000000000*Z^5 + 14176112707271709760517705610597907789759117829653875038542283350216258359375*Z^3 - 15018436703543619216679515337288498307189584069440546124506300648775078125*Z^2 + 15018436703543619216679515337288498307189584069440546124506300648775078125*Z - 5006145567847873072226505112429499435729861356480182041502100216258359375 == 0
Three of the roots are of concern (fit within the un-re-written expression). Two of them are compex valued. The third one is about 0.12824155409435913712
The accuracy of this solution depends upon assuming that where you wrote decimals such as 0.005093 that they should be assumed to be exactly representatable, such as 5093/1000000 exactly -- that the value is not, for example, 0.005092845125 that got rounded to 0.005093.

请先登录,再进行评论。

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by