How can i solve non-linear equation?

3 views (last 30 days)
Well, i tried to solve this equation but i got few errors.
My equation is this :
%MAPPING x(1)=x x(2)=y x(3)=z
f= @(x) [3*x(1)*x(2) + x(2) - x(3) - 12 ; x(1) + x(2)*x(1)^2 + x(3) -12 ; x(1) -x(2) -x(3) +2 ];
x1 = [1;1;1];
fsolve(f,x1)
But i got these errors :
Error using vertcat Dimensions of matrices being concatenated are not consistent.
Error in odev22>@(x)[3*x(1)*x(2)+x(2)-x(3)-12;x(1)+x(2)*x(1).^2+x(3),-12;x(1),-x(2),-x(3),+2]
Error in fsolve (line 230) fuser = feval(funfcn{3},x,varargin{:});
Error in odev22 (line 5) fsolve(f,x1)
Caused by: Failure in initial objective function evaluation. FSOLVE cannot continue.

Accepted Answer

KALYAN ACHARJYA
KALYAN ACHARJYA on 28 May 2018
Edited: KALYAN ACHARJYA on 28 May 2018
% code-No Error
f=@(x) [3*x(1)*x(2)+x(2)-x(3)-12; x(1)+x(2)*x(1)^2+x(3)-12; x(1)-x(2)-x(3)+2];
x1=[1;1;1];
fsolve(f,x1)
  1 Comment
Sam Oznc
Sam Oznc on 28 May 2018
i can't believe the problem was "spaces" between values at equation. Anyway thank you much

Sign in to comment.

More Answers (0)

Categories

Find more on Systems of Nonlinear Equations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!