根据bezier定义
% Bezier Square Curve Ploter
% This file will create a Bezier square curve and dispay the plot.
% The parameter is the Vertex matrix.
function [X] = bezier2(Vertex)
BCon=[1 -2 1;-2 2 0;1 0 0]; % constant Matrix
for i = 1:1:50
par = (i - 1)/49;
XY(i,:) = [par^2 par 1]*BCon*Vertex; % create data
end
% display the vertices and the curve using Matlabs built-in graphic functions
clf % this will clear the figure
plot(Vertex(:,1),Vertex(:,2),'ro',XY(:,1),XY(:,2),'b-')
% create a plot of both the Vertices and curve, the vertices will be red “o”
% while the curve is blue line
line(Vertex(:,1),Vertex(:,2),'color','g') % add the control polygon.
xlabel(' x ')
ylabel ('y ')
title('Square Bezier Curve')
legend('控制顶点','Bezier曲线','控制多边形') % you can move the legend on the plot
然后,在命令行定义Bez2Vertex=[ 0 0 ; 0.3 0.7 ; 1.0 0.2],即定义 , , ,再在命令行输入bezier2(Bez2Vertex)