Kaitlin
Posts:
2
Registered:
2/22/12


Evaluating symbolic functions at specific values of the symbols
Posted:
Feb 22, 2012 7:09 PM


Hello, I am trying to evaluate a symbolically integrated or differentiated function at a specific value of x or t.
For instance, if I start with the code: x=sym('x','positive') t=sym('t','positive')
% That tells the program to treat x and t as symbols so that I can do symbolic differentiation.
u = sin(t*x) % u is my function of interest
w=diff(u) %This differentiates sin(t*x) with respect to x, giving me t*cos(t*x), as hoped.
But now, I would like to evaluate w at some value, for instance t = 2 and x = 3, so that I could put: t=2 x=3 neww = "evaluate" w @ t=2 and x=3
Which would hopefully yield 1.923 as the value for w at this point "2*cos(2*3)" .
I have been trying to make function handles for w, using t and x as inputs, but I apparently need the symbols for x and t to use the differentiation command, so it isn't working. I have been looking at assignin, evalin, clearvars, vpa, and pretty much anything I could think of, but I haven't figured out a way to do it. Any ideas? Help is greatly appreciated.

