0% found this document useful (0 votes)
27 views3 pages

Assignment: Q. Plot A Bezier Curve From Given Points Using MATLAB

Bezier

Uploaded by

Dinesh Newalkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views3 pages

Assignment: Q. Plot A Bezier Curve From Given Points Using MATLAB

Bezier

Uploaded by

Dinesh Newalkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment

Q. Plot a Bezier curve from given points using MATLAB.

% Bezier Curve
% Control Points =10, Polynomial = 9
% P0=(-20,20), P1=(-18,2), P2=(-12,4), P3=(2,-1), P4=(6,4), P5=(10,7), P6=(13,11),
P7=(15,12), P8=(20,20), P9=(30,25)

% Pascal Triangle for polynomial 9


p=[1]
q=[1 1]
y=[1 2 1]

for (j=1:7)
x=[1];
for (i=1:length(y)-1)
x=[x,y(i)+y(i+1)];
end
x=[x,1];
disp(x)
y=x;
end
p=

q=
1 1

y=

1 2 1

1 3 3 1

1 4 6 4 1

1 5 10 10 5 1

1 6 15 20 15 6 1

1 7 21 35 35 21 7 1

1 8 28 56 70 56 28 8 1

1 9 36 84 126 126 84 36 9 1

% u = [0,1] in interval of 0.001


>> u= 0:0.001:1;

[x0,x1,x2,x3,x4,x5,x6,x7,x8,x9]=ndgrid(-20,-18,-12,2,6,10,13,15,20,30);
[y0,y1,y2,y3,y4,y5,y6,y7,y8,y9]=ndgrid(20,2,4,-1,4,7,11,12,20,25);
b=(1-u);
X=
(b.^9).*(x0)+(9).*(u).*(b.^8).*(x1)+(36).*(u.^2).*(b.^7).*(x2)+(84).*(u.^3).*(b.^6).*(x3)+(1
26).*(u.^4).*(b.^5).*(x4)+(126).*(u.^5).*(b.^4).*(x5)+(84).*(u.^6).*(b.^3).*(x6)+(36).*(u.^7
).*(b.^2).*(x7)+(9).*(u.^8).*(b).*(x8)+(u.^9).*(x9);
>> Y =
(b.^9).*(y0)+(9).*(u).*(b.^8).*(y1)+(36).*(u.^2).*(b.^7).*(y2)+(84).*(u.^3).*(b.^6).*(y3)+(1
26).*(u.^4).*(b.^5).*(y4)+(126).*(u.^5).*(b.^4).*(y5)+(84).*(u.^6).*(b.^3).*(y6)+(36).*(u.^7
).*(b.^2).*(y7)+(9).*(u.^8).*(b).*(y8)+(u.^9).*(y9);
>> plot (X,Y)
A= [-20,-18,-12,2,6,10,13,15,20,30]
B= [20,2,4,-1,4,7,11,12,20,25]

plot (A,B ,'k-s');hold on;plot (X,Y)

You might also like