I want to code this problem in MATLAB. It would be a huge help if someone can suggest to me how I can approach it. I need to solve the below-highlighted equation, I need dT/drho. For that, I need to solve for dRp/drho. I do have a dependence on rho but I don't have it explicitly. I have grid points, where I know the values ​​of T, P, dP/drho, Rp, Rp^T, Rq and Rq^T (which are all matrices at those grid points). I also know analytical P. How can I find dRp/drho? I do think of finite difference methods. However, I can't calculate dT/drho at the endpoints of the grid, I have to leave either starting or endpoint on the grid(by considering backward difference or forward difference method) Do I have to extend my grid in that case? or is it possible to code this in MATLAB using 'Cholesky factorization' or something? Because the text below mentions the "unique lower triangular solution" which made me think about 'chol' command in MATLAB. So, as I understand there are two ways to solve this problem. 1. Analytic solution using the below equation. 2. Finite difference method to find dT/drho avoiding all these equations.

I would like to understand from you whether it's possible to code these analytical equations. If not, how can I effectively use finite difference methods? Please feel free to ask questions if you are unclear about the question.

enter image description hereenter image description here

Thank you!

  • 2
    $\begingroup$ It's really hard to follow your question. Please avoid posting pictures instead of writing or equation. We have LaTeX available here that you could write the equations. $\endgroup$ Jan 31 '20 at 16:01

Here's the answer I found out: The analytical equations can be solved as a convex optimization problem. i.e by keeping all terms on one side and introducing an inequality constraint. For example, in this problem,

dP/drho = (dRp/drho)*Rp' + Rp*(dRp/drho)'

can be written as

((dRp/drho)*Rp' + Rp*(dRp/drho)' -dP/drho) >=0

and then solve an optimiation problem to minimize left hand side so that its close to zero. In MATLAB, this can be done through using modelling toolboxes such as YALMIP and solvers like SDPT3 and Sedumi.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.