MATLAB Answers

Time derivative then partial derivative of symbolic function

9 views (last 30 days)
In the following code I would like to take the time derivative and then the partial derivative to x and/or y of a symbolic function.
syms x(t) y(t)
f = 4*x^3 + 3*y^2;
g = diff(f,t);
h = diff(g,x(t));
In line 4 an error tells me "Second argument must be a variable or a nonnegative integer specifying the number of differentiations."
How can I alter my code such that I can take this partial derivative?

  0 Comments

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 22 Oct 2020
Just do:
h = diff(g,x);
and it works.

  6 Comments

Show 3 older comments
Star Strider
Star Strider on 22 Oct 2020
My pleasure.
First, be certain that you have the latest Update to R2020a. This improvement could have been included in the Updates.
Lauran Leermakers
Lauran Leermakers on 22 Oct 2020
I have succesfully upgraded to R2020b. Your suggestion works now! Thanks again

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!