Solve nonlinear equations in app designer

Let's say I need to solve nonlinear equations below in app designer.
function F = root2d(x)
F(1) = 3*x(1)^2+5*x(2)^3-15;
F(2) = 4*x(1)^3-7*x(2)^2+18;
end
I can solve it in app designer if I use this function as an external function and call it form the file. But in my case I need to be able to change coefficents of x(1) and x(2) also. These coefficients can be entered by users of my app so I need to use this function as an internal function (private or public). As an internal function I cannot write a useful code. This is my first question in MATLAB central so it is possible that I cannot explain my problem well. I hope that it is clear. I need your helps.
Thank you already,

 Accepted Answer

Matt J
Matt J on 23 May 2019
Edited: Matt J on 23 May 2019
Have your app code invoke fsolve as follows
fsolve(@(x)root2d(x,c) ,___________ )
where
function F = root2d(x,c)
F(1) = c(1)*x(1)^2+c(2)*x(2)^3-c(3);
F(2) = c(4)*x(1)^3-c(5)*x(2)^2+c(6);
end

More Answers (0)

Categories

Find more on Develop Apps Using App Designer 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!