How to include both Fixed and unknown values in fsolve
Show older comments
I am wanting to solve a system of equations for 2 unknowns and 1 "fixed" value. I have read through Matt's Answer here but am even more confused on how to do so. Here is the code. x and y are my unknowns and u is a "fixed" value.
r=[1 2];
u= 5;
guess=[1,1];
output= fsolve(myfun(r,u),guess);
function F=myfun(r,u)
x = r(1);
y = r(2);
F(1)=x+5*y^2+u;
F(2)=x^2+4*y+u;
end
Cheers,
Answers (0)
Categories
Find more on Linear Algebra in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!