Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
solve in R2008b returns unusable result

Subject: solve in R2008b returns unusable result

From: Joerg Buchholz

Date: 30 Nov, 2008 16:30:20

Message: 1 of 2

If R2008b's solve cannot find a symbolic solution, it returns a numeric solution as a symbolic equation:

>> xx = solve ('sin(x) - x')
 
xx =
 
x = 0.0

The result cannot be used in further computations:

>> sin(xx)
??? Error using ==> map>checkstat at 29
Error: argument must be of 'Type::Arithmetical' [sin]

Error in ==> map at 15
        checkstat(result,status,nargout);

Error in ==> sym.sin at 9
    Y = map(X,'sin');

Subject: solve in R2008b returns unusable result

From: Alan Weiss

Date: 1 Dec, 2008 20:36:25

Message: 2 of 2

Joerg Buchholz wrote:
> If R2008b's solve cannot find a symbolic solution, it returns a numeric solution as a symbolic equation:
>
>>> xx = solve ('sin(x) - x')
>
> xx =
>
> x = 0.0
>
> The result cannot be used in further computations:
>
>>> sin(xx)
> ??? Error using ==> map>checkstat at 29
> Error: argument must be of 'Type::Arithmetical' [sin]
>
> Error in ==> map at 15
> checkstat(result,status,nargout);
>
> Error in ==> sym.sin at 9
> Y = map(X,'sin');

Sorry you got bit by this bug. Until it gets fixed, there is a
workaround: extract the right-hand-side by hand.

xx = feval(symengine,'rhs',xx)

This returns a usable answer:

xx =

0.0

Alan Weiss
MATLAB mathematical toolbox documentation

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us