MATLAB: How to write a symbolic variable funtion

symbolic variable funtion

I followed the instruction for symbolic variables in this link: http://www.mathworks.com.au/help/symbolic/syms.html
But it gives me error instead a function with symbolic variable. Someone please help me! Thanks!
>> clear all
>> syms f(x, y)
Error using syms (line 61)
Not a valid variable name.
>> syms x
>> f(x) = [x x^2; x^3 x^4];
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/double (line 936)
Xstr = mupadmex('symobj::double', S.s, 0);
Error in sym>privformatscalar (line 2707)
x = double(x);
Error in sym>privformat (line 2692)
s = privformatscalar(x);
Error in sym/subsasgn (line 1462)
[inds{k},refs{k}] = privformat(inds{k});
>>

Best Answer

hi,
No the notation f(x) is used in other programming languages ,try :
syms x
f=[x x^2;x^3 x^4]
% automatically f is f(x)
here is second example :
syms x y
F=[cos(x) sin(y); -sin(y) cos(x)];
Related Question