fsolve error when I change the given matrix
Show older comments
I have my prolems like this:
function F=myfun(x)
F=[x(1)+a*x(2)+b*x(3)
x(1)+5*x(2)+4*x(3)
x(1)+2*x(2)+3*x(3)]
P=[1 5 2
3 4 7] %I want to keep this matrix to make easier when I change a and b
a=P(1,1), b=P(1,3)
x0=[0 0 0]
[x,fval,exitflag]=fsolve(@myfun,x0)
and the error is:
Attempt to execute SCRIPT a as a function:
D:\Tinhtraoluucongsuat\flie goc\opt - KG_3_current_constraint_3_7_2015\a.m
Error in myfun (line 2)
F=[x(1)+a*x(2)+b*x(3)
Error in fsolve (line 219)
fuser = feval(funfcn{3},x,varargin{:});
Caused by:
Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue.
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices 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!