Path: news.mathworks.com!not-for-mail
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$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1289694845 28697 172.30.248.38 (14 Nov 2010 00:34:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 14 Nov 2010 00:34:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2607526
Xref: news.mathworks.com comp.soft-sys.matlab:686606

Hi,

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.
example:
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?

Thanks