Hi,
You could find a solution without using the symbolic toolbox.
x0 = 1; % your initial guess of the solution
fzero( @(x) x^ 3 + x^2 + x + 1, x0 )
This will only find a root to the polynomial closest to the
provided initial guess.
Another alternative is the following:
syms x;
solve( ' x ^ 3 + x ^ 2 + 1 ' ) % solves for all roots
Hope this helps. I think you cannot use fzero or fsolve for symbolic
variables.
Misael
"Shweta " <shwetasharma_16@yahoo.com> wrote in message <ibnapt$s0p$1@fred.mathworks.com>...
> 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
