|
In article <g6uq9n$b2p$1@fred.mathworks.com>,
Dave Brackett <davebrackett@hotmail.com> wrote:
>I have 12 data points at the following coordinates:
>
>x: y:
>78 6.00E+07
>233 6.00E+07
>349 6.00E+07
>466 6.00E+07
>587 6.00E+07
>699 6.00E+07
>807 4.00E+07
>932 3.00E+07
>1047 2.00E+07
>1175 1.00E+07
>1281 1.00E+07
>1397 5.00E+06
>At the midpoint between each point y is 0 (not listed
>above). I want to interpolate using an exponential function
>between the y values thereby creating peaks.
Start from an x location that has a y of 0 (e.g., half way
between adjacent x.) Call it H (for "here"). Take the distance
between where you are (H) and the next peak (call it T, for "there").
In that distance, you have to rise from 0 to the value of that next peak.
You wish to use an exponential function, so you will be using exp(c*(t-H))
where t is the position being interpolated, and for some constant c
that depends upon the height you are rising to. However,
that function can never go negative, and at t == H would have a value of 1.
The easiest solution is to use (exp(c*(t-H)) - 1) .
Now you have to figure out the constant c. Keeping in mind the -1
in the equation, you need to rise from 1 to a height of y+1 over a
distance of T-H . So y+1 = exp(c*(T-H)). Take the log of both sides.
log(y+1) = c*(T-H) . Divide through by T-H to get
c = log(y+1) / (T-H) . Now you know that from t=H to t=T, the
equation is (exp(log(y+1) / (T-H) * (t-H)) - 1).
You can use very similar logic to figure out how to fall from
a given height to 0 over a particular distance.
Now your only issues are how to handle the endpoints. You haven't
included any information that would allow us to figure out
the initial point at the left at which the y value should be 0,
nor the terminal point at the right at which the y value should be 0.
If it happened that for the purposes of the problem the peaks
had to be symmetric, then we could calculate the starting and ending
points (but determining the 0 point between peaks would be more
complex.) You gave no indication that the peaks should be
symmetrical -- instead you indicated that you wanted to use
interpolation, which is a term that implies "approximation" and
has no inherent implication of symmetry. For example you might have
been thinking of using a spline fit (somehow or other!) to
determine the data values. When you have an equation family
that gives an exact shape (e.g., "exponential") then the term
that is used for the intermediate values is "calculate", not
"interpolate". On the basis of the information we were given,
a non-symmetric peak model is at least as valid an interpolation as
any other.
The calculation I show above to determine the center positions
and the constants for the exponentials can be vectorized without
much difficulty.
--
"And believe me, I was very lousy yesterday.
I had nothing to say, and, by God, I said it."
-- Walter Wellesley Smith
|