% Clear the screan clc; % Clear all variables clear; % Example of how to solve a nonlinear function using the built in MATLAB % function fsolve. % Set some constants for the nonlinear equation a=1; b=3; c=-1.85E-03; d=-8.45E-05; e=0.05; f=-52.3; %Define the function to be solved: Myfunc = @(x) a+b*x+c*x^2+d*x^3+f*exp(-e*x); % Set an iniitial value to test: xtry=3.14159; Myfunc(xtry) [x,fval]=fsolve(Myfunc,xtry)