Asked by Cristian
on 18 Nov 2012

Hi,

In another pc where I test this line:

double(solve('1=2.*sin(m)'))

Return values are 0.5236 and 2.6180. However, in my computer only returns the 0.5236 value. How I show the second value?

Thank you.

Answer by bym
on 18 Nov 2012

try this (without using string input)

syms t >> double(solve(1-2.*sin(t)))

ans =

0.5236 2.6180

Cristian
on 18 Nov 2012

This:

>> solve('1-2*sin(t)')

ans =

1/6*pi

Walter Roberson
on 18 Nov 2012

Which MATLAB version are you using?

Cristian
on 18 Nov 2012

Version 7.0

Log in to comment.

Answer by Walter Roberson
on 18 Nov 2012

MATLAB 7.0 used Maple for its Symbolic Mathematics Toolbox. Maple only bothers to find a single value in this situation. When Maple is asked to find AllSolutions, it says they are

(1/6)*Pi + (2/3)*Pi*_B1 + 2*Pi*_Z1

The way to read this is that _B1 can be 0 or 1, and _Z1 is any integer (positive or negative). So solutions are at

[...], -11*Pi/6, -7*Pi/6, Pi/6, 5*Pi/6, 13*Pi/6, 17*Pi/6, [...]

Log in to comment.

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

Learn moreOpportunities for recent engineering grads.

Apply Today
## 4 Comments

## Oleg Komarov (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/54032-solve-command-only-shows-one-value#comment_111766

I get an error:

What is your MATLAB version?

## Cristian (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/54032-solve-command-only-shows-one-value#comment_111768

My error. Excuse me.

Without the dot.

## bym (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/54032-solve-command-only-shows-one-value#comment_111774

the documentation says the string can not contain an equals sign. Here are my results (R2008b)

## Walter Roberson (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/54032-solve-command-only-shows-one-value#comment_111800

The equals sign

canappear in modern MATLAB.Log in to comment.