Prev: Calling Java Main Method from Matlab
Next: how to restore GUI after it has terminate by function waitbar in the GUI
From: Nina Hinchy on 10 Mar 2010 11:58 Hi, I'm trying to create a spline from a set of points which form a closed contour and calculate the tangents and normals to the curve at its break points. I've got some code which does most of the work, but I don't understand where its failing. My code just comprises of a few lines, please have a look: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% spline = cscvn(I1_coords); break_coords = fnval(spline, spline.breaks); xPts = break_coords(1,:); yPts= break_coords(2,:); pts = fnval(spline, xPts); tangent = fnval(fnder(spline), xPts); quiver(pts(1,:), pts(2,:), tangent(1,:), tangent(2,:)); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% The output looks like this: http://www.freeimagehosting.net/image.php?511fccf2ec.png If anyone could tell me why only some of the tangent vectors have been drawn and also why 'tangent =fnval(fnder(spline), xPts);' returns two values (I don't understand how this represents the tangent slope) I would really appreciate it. Thanks for your help, N. |