Page 85 - A Guide to MATLAB for Beginners and Experienced Users
P. 85

66        Chapter 4: Beyond the Basics


                     solve(’x+y=3’) solves for x, not y. If you want to solve for y in this
                     example, you need to enter solve(’x+y=3’, ’y’). MATLAB’s default
                     variable for solve is x. If there is no x in the equation(s), MATLAB looks for
                     the letter nearest to x in alphabetical order (where y takes precedence over w,
                     but w takes precedence over z, etc). Similarly for diff, int, and many other
                     symbolic commands. Thus syms w z; diff w*z yields z as an answer. On
                     occasion MATLAB assigns a different primary default variable — for example,
                     the default independent variable for MATLAB’s symbolic ODE solver dsolve
                     is t. This is mentioned clearly in the online help for dsolve. If you have doubt
                     about the default variables for any MATLAB command, you should check the
                     online help.
   80   81   82   83   84   85   86   87   88   89   90