

MATLAB codeĮxample 3: Reconsider Example 1 at the top of the page. If you are using the Academic or Professional (commercial) license of MATLAB, then the Symbolic Toolbox is an optional extra-cost. Go into the installer for the Student Version and request its installation. Suppose you have a symbolic expression f which includes the symbol. If you have Student Version of MATLAB then the Symbolic Toolbox is included but is not installed by default. If all variables are given numerical values, the answer is a number in MATLAB, not “Maple”.Įxample 2: Let us compare simple MATLAB and “Maple” codes which both evaluate the expression y = (x 3 + 2) sec x at x = 0.123. Variable substitution and expression evaluation: subs, eval. The parameters were verified through a range of values to detect the appropriate combination of. It is of the form ans=eval(S) where S is a symbolic expression for which at least one of its symbolic variables has just been given a value. A MATLAB toolbox called GPTIPS (Searson 2009) has been suitability modified for the present purpose. The result g is still a symbolic variable or symbolic constant in “Maple”.Įxample 1: Consider a function of the two Cartesian coordinates f(x, y) =Ĭhange to polar coordinates using x = r cos θ, y = r sin θ and then determine the value of f at an arbitrary point on the unit circle r = 1.į=subs(f,) Īn alternative is to use the eval command. Then you can use the general subs command g=subs(f,old,new) which in our cases would be g=subs(f,x,c) or g=subs(f,x,x0). Suppose you have a symbolic expression f which includes the symbol x and you wish to substitute for x another symbol c or a numerical value x0. Variable substitution and expression evaluation: subs, eval
