Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Hi I am trying to use curve fit some data using the BSplinefunction. I havent been using Mathematica long, so my questions might be quite basic.

pts = {{0, 645.01`}, {5, 645.445`}, {10, 645.622`}, {15, 
646.048`}, {20, 646.475`}, {25, 646.934`}, {30, 647.496`}, {35, 
648.296`}, {40, 649.095`}, {45, 651.485`}, {50, 652.017`}, {55, 
652.611`}, {60, 653.268`}, {65, 653.924`}, {70, 654.231`}, {75, 
654.473`}, {80, 654.8`}, {85, 655.136`}, {90, 655.146`}, {95, 
655.126`}, {100, 656.136`}, {105, 655.116`}, {110, 655.126`}, {115,
655.106`}, {120, 655.116`}, {125, 655.096`}}

using;

SP = BSplineFunction[pts]

I am trying to find out if there is a way to expand this function and look at its individual parts over a specified range within my dataset.

I am also trying to look at the derivative of the function at a specific points by using.

SP'[pts1 = Table[{i, SP'[i]}, {i, 0, 1, .1}];

Is this the right method to get the derivative? If it isnt, I would appreciate it if someone could point in the right direction. Any help is much appreciated.

share|improve this question

1 Answer 1

SP = BSplineFunction[pts]
dsp[t_] = D[SP[t], t]   (* equivalently use SP'[t] *) 
Show[ 
   Graphics[{Red, PointSize[.01], Point /@ pts}],
   ParametricPlot[SP[t], {t, 0, 1}],
   Graphics[Arrow /@ Table[{SP[t], SP[t] + .1 dsp[t] }, {t, 0, 1, .1}]],
   AspectRatio -> 1]

enter image description here

The bspline is a continuous function of the parameter t and does not generally hit your points so its not clear what you mean to look at individual parts.

Edit a bit of qualification on that last point, you can identify a region of influence on the curve associated with each control point. Showing that gets a bit hairy though.

share|improve this answer
1  
I guess the OP needs Interpolation and you can accommodate that possibility in your answer. However the graphics is cool :) so +1... –  PlatoManiac Aug 22 '13 at 20:36
1  
yes, I was going to say the BSpline is likely not the best way to 'fit' that data, but maybe he has some reason.. –  george2079 Aug 22 '13 at 20:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.