


Note that TolX specifies the precision to which $x$ is estimated, not the acceptable size of the remaining error. If necessary, the precision can be increased by setting TolX and possibly other options via optimset: x = fminbnd(err, 0, 1, optimset('TolX', 1e-8)) Considering that the function value goes from 0 at 0 to 110 at 0.99, that is an acceptable precision. Let's check whether the error could be brought down to zero: err(x)

Solve the optimization problem: x = fminbnd(err, 0, 1) This can be framed as an optimization problem: Where is the deviation of the function value from the specific value minimal? Since the variable is bounded to an interval, we can use fminbnd from the Optimization Toolbox.ĭefine the function: fun = 0.03-1/2*0.2^2 + log(100), 0.2^2) +1/2*logninv(x, 0.03-1/2*0.1^2 + log(100), 0.1^2)) ĭefine a function that computes the deviation or error: err = - 100)) You want to find the position within an interval at which a function attains a specific value. Second input must be a scalar or vector of unique symbolic variables.īut this gives me the error: Error using symfun>validateArgNames (line 175) I can solve this using excel with the solver, but I'm trying to solve it with matlab, I use the code: vpasolve(1/2*logninv(x, 0.03-1/2*0.2^2 + log(100), 0.2^2) +1/2*logninv(x, 0.03-1/2*0.1^2 + log(100), 0.1^2) = 100,x,0.24)īut this gives me following error: Error using symfun>validateArgNames (line 175) I would say that interval methods are not overkill – which other method would be able to find all of these roots, and guarantee that they are indeed all of the roots in that box? julia> rts = roots(f, IntervalBox(-100.I would like to solve the equation: 1/2*logninv(x, 0.03-1/2*0.2^2 + log(100), 0.2^2) +1/2*logninv(x, 0.03-1/2*0.1^2 + log(100), 0.1^2) = 100 When solving f(x) x2 + 4x +20 by hand using the quadratic formula. By playing with the tolerance, you can find all roots with the following code (using definition of f). In this project, we introduce Symbolic Math using MATLABs Symbolic Math Toolbox.
