Here we give some notes for matlab symbolic variable creation,expression and evaluation.Symbolic variable are used to design a Mathematical expression with some variables.if you can create Symbolic variable means you must use sym or syms function on Matlab.
Syntax : syms ('var1','var2'........'varn');
above syntax for symbolic variable creation. In below example represent symbolic variable creation and expression with evaluation.
>> syms s % symbolic object name is 's'
>> a = (1+2)/s^2 %symbolic equation generation
a =
3/s^2
>> b = (1+s)/s^2
b =
(1+s)/s^2
Two symbolic variable are addition into one varaible as 'c'.
>> c = a+b;
>> c
c =
3/s^2+(1+s)/s^2
>> subs(c,10)
ans =
0.1400
Finally two symbolic variables added and evaluated.In symbolic variable evaluation using subs function.This function evaluate the object on matlab.finally we got the result.
No comments:
Post a Comment