   Cubic Bezier curves
  Here is the MATLAB code that I wrote to generate a cubic bezier curve given 4 control points.It doesn't interpolate between two endpoints. Can you tell what is wrong with it?---------------------clcclearp0 = [ 0; 0 ];p1 = [ 5; 10 ];p2 = [ 10; 15 ];p3 = [ 20; -10 ];G = [ p0 p1 p2 p3 ];B = [ 1 -3 3 -1; 0 3 -6 -3; 0 0 3 -3; 0 0 0 1 ];i = 1;for t = 0:0.05:1    T(1,i) = 1;    T(2,i) = t;    T(3,i) = t^2;    T(4,i) = t^3;    i = i + 1;endcurve = G*B*T;grid onhold onplot( curve(1,:), curve(2, :) );plot( G(1,:), G(2,:), '--rs',  'MarkerSize', 10 );hold off---------------------<br/>   
  Hi Dynx, I think you have an error in your B matrix(the coefficient for P1*t^3 should be +3, not -3). Try this B = [ 1 -3 3 -1; 0 3 -6 3; 0 0 3 -3; 0 0 0 1 ];   ;  Yep that was it thanks.   