Hello all, I'm trying to solve nonlinear simultaneous equations. However, Matlab is giving errors, which I cannot rectify. Any help is much appreciated.
I made a function file:
function [ f ] = nlsimul( x)%nlsimul has two nonlinear simultaneous equations in variable x(1), x(2)
f = [-2*(x(1).^2).*exp(-x(1).^2-(x(2).^2))+exp(-x(1).^2-(x(2).^2)); ... -2.*x(1).*x(2)*exp(-x(1).^2-(x(2).^2))];end
Then I made a script file to solve this system of equations:
%This script calles nlsimul() to solve nonlinear simultaneous equations
options = optimoptions('fsolve','Diagnostics','on','Display','iter','PlotFcns','@optimplotresnorm');x0=[2,2];[x,fval,exitflag,output] = fsolve(@nlsimul,x0,options)
Upon running this script file, Matlab gives several errors. Can someone help?
Best Answer