Re: how to express weighted average in this case?
- From: ikuyasu@xxxxxxxxx
- Date: 11 Sep 2006 14:10:01 -0700
No, it's not. It doesn't work this way.
I want:
A = B when t = 1
A = C when t = t*
A = D when t = T.
But this way,
A = C when t = t*, but other two conditions don't hold.
ikuyasu@xxxxxxxxx wrote:
Did you mean like this?
A1 = [ 1 - (t-1)/(t*-1) ]*B + [ (t-1)/(t*-1) ]*C
A2 = [ 1 - (t-t*)/(T-1) ]*B + [ (t-t*)/(T-1) ]*C
, and
A = 0.5*A1 + 0.5*A2 for t = 1,...,t*,...,T.
Randy Poe wrote:
ikuyasu@xxxxxxxxx wrote:
Randy Poe wrote:
ikuy...@xxxxxxxxx wrote:Thank you very much, Randy.
Hi,
A = [ 1 - (t-1)/(T-1) ]*B + [ (t-1)/(T-1) ]*C gives you A = B when t =
1 and A = C when t = T.
Also, the transition from t = 1 to T is linearly increasing.
Yes. The first coefficient can also be expressed as
(T-t)/(T-1).
Another way to write this is:
A = (1-f)*B + f*C where f varies from 0 to 1. It is the fact that
the coefficients add up to 1 which forces this to generate
points on the line from B to C.
I want to do the same sort of things for 3 points such as
A = something*B + somethingelse*C + somethingelse*D with A = B when t =
1, A = C when t = t*, and A = D when t = T for t = 1,...,t*,...T.
If you have A = b*B + c*C + d*D with b+c+d = 1, and all
three coefficients >=0, then A will always lie in the triangle
formed by B, C and D.
I came up with this:
A = [(t-t*)(t-T)/(1-t*)(1-T)]*B + [(t-1)(t-T)/(t*-1)(t*-T)]*C +
[(t-1)(t-t*)/(T-1)(T-t*)]*D.
You've just re-invented Lagrange interpolation. The result
is that the x-component of A is a quadratic in t which goes
through B_x at t=1, C_x at t=t* and D_x at t=T, and
similarly for the y-component.
The sum of the first weight and the last weight decrease, become zero
at t = t*, and increase, but the sum of the first and second and the
second and the last exceeds one at some interval. So, it is hard to say
that those can be seen as "weights".
As t varies from 1 to T, A will describe a curve which will
pass through B, C and D at the desired values of t. But
it won't always lie in the triangle.
What properties of this trajectory were you hoping for?
It sounds like for you, proper "weights" will limit the
trajectory to the interior of the triangle.
I guess I want the weights to be interior of a triangular formed by B,
C and D.
Could you tell me how to do that?
How about piecewise linear interpolation?
Use your previous scheme to interpolate linearly from B
to C as t varies from 1 to t*, then a separate linear
interpolation from C to D as t varies from t* to T.
- Randy
.
- References:
- how to express weighted average in this case?
- From: ikuyasu
- Re: how to express weighted average in this case?
- From: Randy Poe
- Re: how to express weighted average in this case?
- From: ikuyasu
- Re: how to express weighted average in this case?
- From: Randy Poe
- Re: how to express weighted average in this case?
- From: ikuyasu
- how to express weighted average in this case?
- Prev by Date: Re: Cluster points
- Next by Date: Re: Closest points on 2 3-dimensional lines
- Previous by thread: Re: how to express weighted average in this case?
- Next by thread: Re: how to express weighted average in this case?
- Index(es):
Relevant Pages
|