% B样条曲线生成实例 % NUMERICAL METHODS: Matlab Programs % (c) 2007 by Xie Liling % Complementary Software to accompany the textbook: % Information and Computing Science: A Laboratory Course ctrlpoints=[0 -1.2 -1.6 -1.4 -1 -0.5 -0.35 -0.6 -1.6; -0.2 -0.5 -1 -1.5 -2.2 -2.7 -3.2 -3.7 -4.2]; knots=[0 0 0 0 1 2 3 4 5 6 6 6 6]; x0=ctrlpoints(1,:); y0=ctrlpoints(2,:); plot(x0,y0,'ro');%画所有控制点 hold on; sp = spmak(knots,ctrlpoints);%生成B样条函数 fnplt(sp,[knots(1),knots(13)]);%根据所有节点,画样条曲线图 axis equal