如何用matlab绘制贝塞尔曲线
10阶贝塞尔曲线(平面曲线),控制点分别为(0,1.2),(0.04,0.6),(0.15,0.51),(0.32,0.88),(0.31,0.09),(0.52,0),...
10阶贝塞尔曲线(平面曲线)
,控制点分别为
(0, 1.2), (0.04, 0.6), (0.15, 0.51), (0.32, 0.88),
(0.31, 0.09), (0.52, 0), (0.62, 0.8), (0.89, 0.87), (0.92, 0.6), (0.92, 0.3),
(0.75, 0). 展开
,控制点分别为
(0, 1.2), (0.04, 0.6), (0.15, 0.51), (0.32, 0.88),
(0.31, 0.09), (0.52, 0), (0.62, 0.8), (0.89, 0.87), (0.92, 0.6), (0.92, 0.3),
(0.75, 0). 展开
1个回答
展开全部
以下是运行结果:
程序代码:
function bezier(x,y)
x=[0,0.04,0.15,0.32,0.31,0.52,0.62,0.89,0.92,0.75];
y=[1.2,0.6,0.51,0.88,0.09,0,0.8,0.87,0.6,0.3,0];
n=length(x);
t=linspace(0,1);
xx=0;yy=0;
for k=0:n-1
tmp=nchoosek(n-1,k)*t.^k.*(1-t).^(n-1-k);
xx=xx+tmp*x(k+1);
yy=yy+tmp*y(k+1);
end
if nargout==2
X=xx;Y=yy;
end
h=plot(xx,yy);
if nargout==1
X=h;
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询