I posted a (rather intricate!) worksheet formula for this a while back:
http://www.mrexcel.com/forum/showthread.php?543636-interpolation-of-a-curve
The xlrotor code on Brian Murphy's site is only an approximate match to the actual smooth line curve, an accurate algorithm is here:
http://answers.microsoft.com/en-us/...00?msgId=5b59b6de-5099-48d1-b205-1b791ea2df05
Lori,
I am trying to do a basic plot of bezier curve and my curve does not seem to fit all the 4 points by using a bezier curve. It only fits the first point and end point. I guess that is what wikipedia says. If i would like to fit all points, what do i have to do? :
(9,6)
(11,9)
(13,9)
(14,13)
I have used formulas from website such as
p1 + (p2 - p1) * t = q1
p2 + (p3 - p2) * t = q2
p3 + (p4 - p3) * t = q3
q1 + (q2 - q1) * t = r1
q2 + (q3 - q2) * t = r2
p(x) = r1 + (r2 - r1) * t
p
= r1 + (r2 - r1) * t
Where
0 < t < 1 : Step of 0.1
p1 = position of point number 1, in this case 9
p2 = position of point number 2, in this case 11
Here I derived all of q1, q2, q3. (Total # of points for each q is 11. Therefore there is 33 points.)
Then i derived all of r1 & r2 (Total # of points for each r is 11. Therefore there is 22 points.
and then p(x), p
(Total # of points for each r is 11. Therefore there is 11 points.
I am not sure what is missing here but apparently I am not doing something right here.
Then i tried this formula, which is the same.
http://paulbourke.net/geometry/bezier/bezier1.gif
and I still couldn't get the curve to go through all the points.
http://i.imgur.com/j821S.jpg
Now I am going to try the cadmul-rom code that you have here.
I saw that you have this code which helps to determine the point of y given x. Therefore I can do a small step of x and generate y. but it seems like it only take x = 1 to 19 into account. How do i get points for 21, 21.5,23.5 etc. I have reference the points from this website:
Code:
=SUM((1+1/(IRR(MMULT({0,0,2,0;0,1,0,-1;-1,4,-5,2;1,-3,3,-1},OFFSET(A$2,MATCH(E2,A$2:A$12)-2,,4)-E2))+1E-20
))^-{0;1;2;3}*MMULT({0,2,0,0;-1,0,1,0;2,-5,4,-1;-1,3,-3,1},OFFSET(B$2,MATCH(E2,A$2:A$12)-2,,4)))/2
Hope i can get a more detail explanation on how these curves fit in between 2 points, or 10 points and meet every point that is given.
I'm not sure how you derive the matrix for cadmul-rom formula either.
This is the equation that i have, and if we were to use tau as 1, we would get [{0,1,0,0},{-1,0,1,0}, {2,-2,1,-1},{-1,1,-1,1}] instead of [{0,2,0,0},{-1,0,1,0},{2,-5,4,-1},{-1,3,-3 1}].
Do let me know if i misunderstand.
http://imgur.com/ix9jP
Cheers!!!