avi
avi

Reputation: 170

Solve function returning symbol

I am trying to use the MATLAB Symbolic Math Toolbox to solve simple equations, but I am not receiving the expected/desired result.

I'm using Windows 10, and this is the output of entering ver into the Command Window:

    MATLAB Version: 9.6.0.1335978 (R2019a) Update 8
    MATLAB License Number: STUDENT
    Operating System: Microsoft Windows 10 Pro Version 10.0 (Build 19041)
    Java Version: Java 1.8.0_181-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
    -----------------------------------------------------------------------------------------------------
    MATLAB                                                Version 9.6         (R2019a)
    Simulink                                              Version 9.3         (R2019a)
    Control System Toolbox                                Version 10.6        (R2019a)
    Curve Fitting Toolbox                                 Version 3.5.9       (R2019a)
    DSP System Toolbox                                    Version 9.8         (R2019a)
    Data Acquisition Toolbox                              Version 4.0         (R2019a)
    Image Processing Toolbox                              Version 10.4        (R2019a)
    Instrument Control Toolbox                            Version 4.0         (R2019a)
    Optimization Toolbox                                  Version 8.3         (R2019a)
    Parallel Computing Toolbox                            Version 7.0         (R2019a)
    Signal Processing Toolbox                             Version 8.2         (R2019a)
    Simulink Control Design                               Version 5.3         (R2019a)
    Statistics and Machine Learning Toolbox               Version 11.5        (R2019a)
    Symbolic Math Toolbox                                 Version 8.3         (R2019a)

According to the in-app documentation, the solve function should follow this syntax:

    syms x
    eqn = sin(x) == 1;
    solx = solve(eqn, x)

And the expected output from this is:

solx =

                                       pi/2

However, when I run the same commands I receive:

    >> syms x
    >> eqn = sin(x) == 1;
    >> solx = solve(eqn, x)
     
    solx =
     
                                           x

I have tried a number of even simpler equations with the same result (receiving symbol instead of a numerical value). What am I doing incorrectly? Thanks in advance.

Upvotes: 1

Views: 102

Answers (1)

Vicky
Vicky

Reputation: 949

As discussed in the comments, your MATLAB installation does not seem to use the function in ...\toolbox\symbolic\symbolic\solve.m when a solve command is issued; instead, an unrelated function provided by the maple toolbox is used, leading to some confusion. This issue can be solved by reordering the MATLAB search path:

p=path();
path(p,'C:\Program Files\MATLAB\R2019a\toolbox\maple');

Upvotes: 2

Related Questions