From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: fzero or fsolve to solve equation with symbols defined
Date: Sun, 14 Nov 2010 00:34:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 20
Message-ID: <ibnapt$s0p$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1289694845 28697 (14 Nov 2010 00:34:05 GMT)
NNTP-Posting-Date: Sun, 14 Nov 2010 00:34:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2607526
Xref: comp.soft-sys.matlab:686606


In my code I define a few symbols and later on I obtain a non linear equation in one of those symbols for which I need to calculate the root.
syms x;
g = x^3 + x^2 + x + 1;

% to solve for the roots of the above equation, I tried using
h = fzero(g,1);

 It gave me the following error:

If FUN is a MATLAB object, it must have an feval method.

Error in ==> fsolve at 184
    funfcn = lsqfcnchk(FUN,'fsolve',length(varargin),funValCheck,gradflag);

How do I solve this?