Incorrect number or types of inputs and outputs for function 'isfinite'

62 views (last 30 days)
I want to solve this nonlinear system, but it always says in red: Incorrect number or types of inputs and outputs for function 'isfinite', and I'm a beginner I don't know how to fix it.
Could you please give me some advice? Thx.
x=fsolve('@system',[0 0])
Incorrect number or types of inputs or outputs for function 'isfinite'.

Error in fsolve (line 306)
if any(~isfinite(fuser))
function f=system(x)
f=[2*x(1)+x(2)+x(1)^3; x(1)+x(1)*x(2)+exp(x(1))];
end

Accepted Answer

Florian Bidaud
Florian Bidaud on 7 Sep 2023
Edited: Florian Bidaud on 7 Sep 2023
You need to remove the quotes
x=fsolve(@system,[0 0])
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
x = 1×2
-0.3783 0.8108
function f=system(x)
f=[2*x(1)+x(2)+x(1)^3; x(1)+x(1)*x(2)+exp(x(1))];
end

More Answers (0)

Tags

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!