Matlab 5 Symbolic Differences
This is a preliminary help note 'First Help Symbolic Matlab-5' for Matlab-4
users.
%%% 'version 5 matlab'
There are now objects: important are
sym symbolic
char strings
important functions
sym declaratio
sym2map(a)
subs new syntax
M4 subs('x^2','xnew','x')
M5 subs(x^2, x ,xnew) but after syms x new !!!
see some examples in the capture below
------------------------------------------------
%% You declare symbolic objects
>> syms a b c x y
>> a=c*x^3+b^2
a =
c*x^3+b^2
u=[ 'y=' sym2map(a) ] % convert symbolic to string
u =
y=c*x^3+b^2
>> eval(u)
y =
c*x^3+b^2
>> diff(y,x)
ans =
3*c*x^2
>> whos
Name Size Bytes Class
a 1x1 142 sym object
ans 1x1 138 sym object
b 1x1 126 sym object
c 1x1 126 sym object
u 1x11 22 char array
x 1x1 126 sym object
y 1x1 142 sym object
Grand total is 45 elements using 822 bytes
>> v=strrep(u,'y','z') % doing a string operation
v =
z=c*x^3+b^2
>> b=subs(a,x,y)
b =
c*(c*x^3+b^2)^3+b^2
>> a
a =
c*x^3+b^2
>> syms xx % declare a new symbolic
>> b=subs(a,x,xx) % doing a symbolic replacement
b =
c*xx^3+b^2
>> maple('with orthopoly;')
The Extend_Symbolic_Toolbox feature is not currently licensed.
Contact MathWorks to obtain a valid license.
'with(...)' requires extended symbolic toolbox.
??? Unable to checkout a license for the Extended Symbolic Toolbox
>> a
a =
c*x^3+b^2
>> b
b =
c*xx^3+b^2
>> c
c =
c
>> a+b+c
ans =
c*x^3+2*b^2+c*xx^3+c