MATLAB: Partial derivative can anybody help me to slove this

ode45partial derivative de

Best Answer

Presumably you know density and saturation pressure as a function of temperature, either as functions or as data tables. This means you can simply express those terms on the right hand side that involve them as functions in Matlab (using interp1, say, if they are in the form of tabulated data). You would then simply have an ode to solve for x in terms of T. Your rate of change of x with respect to T function might have the following structure
function dxdT = odefn(T, x, dlnrho, lnP, dlnP)
n = ...
D = ...
dxdT = x*dlnrho(T) - x*n*D*(T*lnP(T))^(n-1)*(lnP(T) + T*dlnP(T));
end
where dlnrho, lnP, dlnP are functions (of T) that you've defined elsewhere in the file.
You would then call odefn with, say, ode45, having first specified an initial value for x and a temperature range for T.