MATLAB: Creating Symbolic Functions

argnameserrorpolynomialssymsymbolicvariables

Hey all. I'm new to Matlab and a first time poster here. I'm trying to create a multivariate symbolic polynomial and access its variables using the argnames function, which I found here:
Running the example code at the linked page, I get the following:
>> syms f(x, y);
??? Error using ==> syms at 61
Not a valid variable name.
Then I looked at the documentation for sym here:
I tried running the example code for a symbolic function found there, which produced:
>> x = sym('x');
>> y = sym('y');
>> f(x, y) = x + y;
??? Error using ==> mupadmex
Error in MuPAD command: DOUBLE cannot convert the input expression into a double
array.
If the input expression contains a symbolic variable, use the VPA function instead.
Error in ==> sym.sym>sym.double at 936
Xstr = mupadmex('symobj::double', S.s, 0);
Error in ==> sym.sym>privformatscalar at 2678
x = double(x);
Error in ==> sym.sym>privformat at 2663
s = privformatscalar(x);
Error in ==> sym.sym>sym.subsasgn at 1433
[inds{k},refs{k}] = privformat(inds{k});
Then I tried the following, just to see if it would work (it didn't):
>> x = sym('x');
>> y = sym('y');
>> f = x+y;
>> argnames(f);
??? Undefined function or method 'argnames' for input arguments of type 'sym'.
What am I doing wrong?

Best Answer

The concept of 'symbolic functions' including the function argnames have been introduced in MATLAB 2012a. You cannot use this feature in earlier versions.