I Have two set of data separately, which one of them is pressure and the other one is energy density.(P: pressure, E: energy density) I want to use these data as a function, P(E) or E(P) by using Interpolation. Could you please help me that how I can make a function of these data?
For instance in Matlab I wrote the codes below and it works well.
E=interp1(Data(:,2),Data(:,1),P);
P=interp1(Data(:,1),Data(:,2),E);
Data 1 is energy density and Data 2 is pressure.
In fact by the codes above in Matlab I could give an arbitrary pressure and then the result is the correspond energy density or vice versa.
My question is that how I can write such a code in Mathematica.
To clarify more, I have a set of data for energy density which I named it Data1 and another set of data for pressure named Data2 that were imported in the notebook.
The number of elements of both of data are equal since these data are related to a plot which shows pressure in terms of energy density.
Due to I do not have an explicit function for energy density in terms of pressure or pressure in terms of energy density I have to use interpolation.
In fact by using Interpolation I could use these data as a function. For instance, I choose an arbitrary pressure p1 for this code in Matlab, E=interp1(Data(:,2),Data(:,1),p1);
Then it gives me the corresponding energy density by the interpolation, or for an arbitrary energy density e1 I can use this code,
P=interp1(Data(:,1),Data(:,2),e1); and the result is the corresponding pressure.
Now I want to do the calculation explained above by Mathematica.
Import
. For interpolation there isInterpolation
and for fitting data to a model there isFindFit
. If you need help with any of these update your post and specify what the problem is specifically. $\endgroup$