I have two typical (x,y(x)) curves. The two of them expand over a similar x range but have different "resolution". This is, while one of the will cover an x range with 300 x-values the second curve has 3200 values for aproximately the same range.
I want to multiply the two curves (curve1 * curve 2) so that the data in curve2 is mapped onto the data in curve1.
How one can do this in R. In case is useful, x values are always monotonically increasing.
Let's say your curves are two arrays c1
and c2
known on the discretization points x1
and x2
.
You should do the following to have the curve 2 on the x-values of curve 1:
c2.modified <- approx(x2, c2, x1)
Then you just multiply:
c2.modified * c1