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 utilizing an Interpolation between them. 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 they work well.
E=interp1(Data(:,2),Data(:,1),P);
P=interp1(Data(:,1),Data(:,2),E);
Regarding the codes in Matlab, I have a Matrix named Data which the first column is related to energy density and the second column is for pressure.
In fact, by the codes above in Matlab, I could give an arbitrary pressure and then the result is the corresponding energy density or vice versa.
For my Mathematica code, I separated the columns of the matrix mentioned above into two data as two Excel files. Then these two files were imported in the notebook in order to make an interpolation between them to utilize it as a function. Indeed the interpolation between energy density and pressure could work like a function which gives pressure in terms of energy density or vice versa.
My question is that how I can write such a code in Mathematica.
Thanks a lot for your attention.
To clarify more, In my notebook I have a set of data for energy density which I named it DataA and another set of data for pressure named DataB that were imported.
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 written in Matlab, E=interp1(Data(:,2),Data(:,1),p1);
It gives me the corresponding energy density by utilizing the interpolation
For an arbitrary energy density e1 I can use this code written in Matlab, 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.
I faced this error, Interpolation::indat: Data point 1 contains abscissa 2, which is not a real number.
May be there is problem in my data.
Can I send you my Data? They are as a Excel file.