Programming B-spline curve in Matlab from scratch

In summary, the conversation discusses using basis functions and control points to calculate the value of a B-spline curve. The speaker is seeking help with properly implementing the blending function and is asking for a MATLAB code to plot the curve.
  • #1
roldy
237
2
I decided to write my problem and attach as a separate document so that everything was included and would leave room here to discuss my problem.

From what I understand from the equations is that for each value of u I calculate the value of the basis function for each basis function i. Then this is multiplied by the control point. This is done for each order k. The thing that I don't understand is that how can I pull this off if u is the inner most loop? I'm not sure the proper placement of the blending function P(u).

Could someone take a look at my code and logic and see if there is another way of doing this or shoot me some pointers? It would be greatly appreciated.
 

Attachments

  • problem.pdf
    49.4 KB · Views: 733
  • Bsplineplot.txt
    2.6 KB · Views: 929
Physics news on Phys.org
  • #2
hi my friend, :)
I see your code.
I test it and it works good,but did you write a MATLAB code for using Basis-function to plot B-spline curve?!
could you upload it for me?
thanks.
 

1. How do I define the control points for a B-spline curve in Matlab?

The control points for a B-spline curve can be defined using the bsplinepts function in Matlab. This function takes in the number of control points, the degree of the curve, and the knot vector as inputs and returns a matrix of control points.

2. How can I plot a B-spline curve in Matlab?

To plot a B-spline curve in Matlab, you can use the bsplineplot function. This function takes in the control points, degree, and knot vector as inputs and plots the curve. You can also use the plot function to plot the control points and the curve separately.

3. How do I modify the degree of a B-spline curve in Matlab?

The degree of a B-spline curve can be modified using the bsplinedegree function in Matlab. This function takes in the current degree of the curve and the desired degree as inputs and returns a new set of control points and a new knot vector with the modified degree.

4. Can I interpolate data points on a B-spline curve in Matlab?

Yes, you can interpolate data points on a B-spline curve in Matlab using the bsplinefit function. This function takes in the data points, degree, and knot vector as inputs and returns a set of control points that pass through the given data points.

5. Is it possible to create a closed B-spline curve in Matlab?

Yes, you can create a closed B-spline curve in Matlab by specifying the first and last control points to be the same. This will create a curve that loops back on itself, creating a closed shape. You can also use the bsplineclose function to automatically close a B-spline curve.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
712
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
32
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
22
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
11K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
819
Back
Top