2
$\begingroup$

For example,

data1 =

0 1 1 2 3 3 5 2 6 2 9 4 11 5 13 6 14 7 16 8

data2 =

0 2 1 3 2 2 3 1 4 2 6 3 8 4 9 6 11 4 16 7

each data have different x-axis interval. so I cannot calculate about these two data set such as multiply each other or dividing each other.

I have to do interpolation and make the data as a function.

how to make it possible?

ex: data1/data2 or data1 x data2

$\endgroup$
  • 1
    $\begingroup$ Please try to write your code in Mathematica syntax $\endgroup$ – Dr. belisarius Nov 25 '14 at 1:22
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Dr. belisarius Nov 25 '14 at 1:23
3
$\begingroup$

This question is not clear but making a few assumptions this is a direct application of the Interpolation function.

data1 = {0, 1, 1, 2, 3, 3, 5, 2, 6, 2, 9, 4, 11, 5, 13, 6, 14, 7, 16, 8};
data2 = {0, 2, 1, 3, 2, 2, 3, 1, 4, 2, 6, 3, 8, 4, 9, 6, 11, 4, 16, 7};

Now assuming that the data is actually x1,y1,x2,y2,...

xy1 = Partition[data1,2];
xy2 = Partition[data2,2];

Plot it.

ListPlot[{xy1,xy2}]

func1 = Interpolation[xy1, InterpolationOrder -> 1]
func2 = Interpolation[xy2, InterpolationOrder -> 1]

func1[5]/func2[5]

Show[ListPlot[{xy1, xy2}, PlotRange -> All], Plot[{func1[x], func2[x]}, {x, 0, 15}]]

Plot of data and linear interpolation.

$\endgroup$

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.