From: sudhakar bendi on
I am new to to matlab.Just I want to solve an equation and from those roots i want to select real&positive root.I am trying to excute a simple program,but it is showing undefined method or function 'gt' for input arguments of type 'sym'.Can u help me
anybody in this.
Program is

syms x;
x=solve('x^4+4*x^2-6400');
double(x);
for i=1:4
if(double(imag(x(i,1)))==0)&(double(real(x(i,1)>0))))
w=x(i,1)
else
w=0
end
end
From: John D'Errico on
"sudhakar bendi" <bendi_sudhakar(a)yahoo.co.in> wrote in message <hui564$iav$1(a)fred.mathworks.com>...
> I am new to to matlab.Just I want to solve an equation and from those roots i want to select real&positive root.I am trying to excute a simple program,but it is showing undefined method or function 'gt' for input arguments of type 'sym'.Can u help me
> anybody in this.
> Program is
>
> syms x;
> x=solve('x^4+4*x^2-6400');
> double(x);

So what do you think this last line does?

It makes a double precision number of the result, and
then throws it away! It does NOT store the result in x.

John
From: Walter Roberson on
sudhakar bendi wrote:
> I am new to to matlab.Just I want to solve an equation and from those
> roots i want to select real&positive root.I am trying to excute a simple
> program,but it is showing undefined method or function 'gt' for input
> arguments of type 'sym'.Can u help me anybody in this.
> Program is
> syms x;
> x=solve('x^4+4*x^2-6400');
> double(x);
> for i=1:4
> if(double(imag(x(i,1)))==0)&(double(real(x(i,1)>0))))
> w=x(i,1)
> else
> w=0
> end
> end

x(i,1)>0 will be a logical value, so there is no point in taking the
real portion of it.

Perhaps you meant double(real(x(i,1)))>0