Partial Differentiation wrt a Symbolic Variable Defined as Another Function

6 views (last 30 days)
I am trying to reduce the amount of times that I have to use the subs command and have run into this problem quite a bit when using symbolic differentiation. In my case I'd like to take the derivative of a function with respect to another variable that has already been defined as a generic function of "t". The below example should describe what I mean by that. To be clear this is something that I would like to do.
syms detheta dy; y=sym('y(t)'); theta=sym('theta(t)'); Rb=y - L*cos(theta); dRb=diff(Rb,y)*dy+diff(Rb,theta)*dtheta;
What I just do now is substitute the values 'y(t)' and 'theta(t)' for a different symbolic variable such as yS and thetaS into Rb, take the partial wrt the desired yS/thetaS, then substitute the original 'y(t)'/'theta(t)' back into the equation since I will later need them back in that form. Is there a more streamlined way to do this in 2013a w/ symbolic toolbox?

Answers (1)

Nalini Vishnoi
Nalini Vishnoi on 5 May 2015
Yes, you can use the 'Chain rule'. Look at the discussions in this Answers post .

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!