I want to solve this equation and find 'u' in Matlab.
for the left side of this equation, we have chi2cdf(u, 2*Nr, 'upper')
but i can't use this and got an error.
syms x positive
eqn = chi2cdf (x,2,'upper');
and i got this error:
Error using symengine
cannot prove 'x<0' literally. to test the statement mathematically, use isAlways.
How can I solve this?
x
matter only when evaluating the
function[0, inf]
, sign implicitly setted to positivefzero()
to solve equation equal to zerofzero()
doesn't allow infinite bound, inf
could be replaced by exp(709)
- Why
exp(709)
?:exp(709) = finite
whileexp(710) = infinite
Code is as follows
% Assuming L, M
L = 0.1;
M = 2;
% Equation
f =@(x) chi2cdf (x,2,'upper')-L/M;
% solve
sol = fzero(f, [0, exp(709)]);
Solution
sol = 5.9915