CAD/Differentiation and Integration in Matlab
Expert: George Moustris - 4/13/2006
QuestionGeorge,
I have a simple problem I need to resolve for research for a class project I'm working on.
I am studying the cardiovascular arterial system and this one equation states compliance is the ratio of an incremental change in volume due to an incremental change in distending pressure or otherwise written (C=dV/dP).
I have discrete values in Matlab already for C and P. I need to calculate V as a function of P. Thus, the equation becomes dV=C*dP. I have approximately 43 discrete points for C and P each. How can I go about solving this differential equation for V in Matlab so it will produce 43 discrete values for V? Thank you very much. Any help is much appreciated.
AnswerHi Jeyur,
what you need is numerical integration. The DE you have can be solved by integrating dV, i.e. V=SCdP, where S is the integral sign. Since you only have data points and not a function, you must use numerical intragration methods. The command you are looking for is cumtrapz.
Z = cumtrapz(X,Y) computes the cumulative integral of Y with respect to X using trapezoidal integration. X and Y must be vectors of the same length, or X must be a column vector and Y an array whose first nonsingleton dimension is length(X). cumtrapz operates across this dimension. Inputs X and Y can be complex.
Best
G.