How to evaluate a partial derivative.

17 views (last 30 days)
Tyler Cooper
Tyler Cooper on 30 Sep 2016
Answered: Walter Roberson on 30 Sep 2016
I am trying to do propagation of uncertainty for an experiment. I am able to define the derivatives, but I cant figure out how to input the actual values of the variables after the differentiation.
Code starts here:
syms P1 P2 P3 T1 T3
Cp=R_air*((log(P2/P1))/(log((T*(P2/P3))/(T))))
DCp_DP1=diff(Cp,P1)
DCp_DP2=diff(Cp,P2)
DCp_DP3=diff(Cp,P3)
DCp_DT1=diff(Cp,T1)
DCp_DT3=diff(Cp,T3)
Now that MATLAB has taken the partial derivatives, I want to evaluate these derivatives at
P1=16.243, P2=11.595, P3=12.575, T1=293.25, and T3=293.25

Answers (1)

Walter Roberson
Walter Roberson on 30 Sep 2016
vars = {P1, P2, P3, T1, T3};
vals = {16.243, 11.595, 12.575, 293.25, 293.25};
subs(DCp_DP1, vars, vals)

Categories

Find more on Function Creation in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!