Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Evaluating symbolic functions at specific values of the symbols
Replies: 4   Last Post: Mar 10, 2013 1:03 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Kaitlin

Posts: 2
Registered: 2/22/12
Evaluating symbolic functions at specific values of the symbols
Posted: Feb 22, 2012 7:09 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.