Clear Filters
Clear Filters

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

17 views (last 30 days)
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.

Accepted Answer

Matt J
Matt J on 10 Apr 2021
Edited: Matt J on 10 Apr 2021
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 Comments
Walter Roberson
Walter Roberson on 10 Apr 2021
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.

Sign in to comment.

More Answers (0)

Categories

Find more on Optimization in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!