Issue with diff function, symbolic toolbox, three tiny lines of code to illustrate!

1 view (last 30 days)
Hi there!
I'm trying to use the diff function in Matlab for a very, very complicated piece of code. There's an issue, however. Suppose I have an arbitrary function, say, a(x). I want to symbolically take lots of derivatives of a(x), and then substitute in for various x's later. This is a problem though.
For example
syms x y z
syms a(u)
diff(a(x),x)
This is wrong. What I want is the answer I get from this
syms u
syms a(u)
diff(a)
ans(u) =
D(a)(u)
Except I want to be able to do that for many, many 'u's. I know there must be a simple solution to this problem, but I can't figure it out.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!