clc clear all disp('PURPOSE') disp(' To solve a nonlinear equation') disp(' ') % example for solving a nonlinear equation % varible to solve must be symbolic disp('INPUTS') syms x % using the solve command eqn='3*x^3-15*x^2+47*x=33'; fprintf(' The equation to solve is: %s\n\n',char(eqn)) % using the solve command soln=solve(eqn,x); % converting the exact answer to decimal format using double soln=double(soln); disp('OUTPUTS') disp(' The complete solution to the equation is:') disp(soln)