Question

MATLAB lot Bezier curves: The concept of the Bezier curve is described in the wikipedia. Plot...

MATLAB

  1. lot Bezier curves: The concept of the Bezier curve is described in the wikipedia.
    1. Plot 5 randomly generated data points on the x-y plane and connect them with straight lines. Be sure to label the data points as p1, p2, p3, p4, and p5.
    2. Draw a 4th-order Bezier curve on top of the above 5 data points.

Homework Answers

Answer #1

MATLAB CODE :

clc

n=input('Enter no. of points ');

w=input('Press 1 for entry through mouse or 2 for keyboard -->');

n1=n-1;

if w==1

axis([0 100 0 100])

[p]=ginput(n);

end

if w==2

[p]=input('Enter co-odinates of points within brackets ->[x1 y1;x2 y2;x3 y3;...;xn yn] ');

end

for i=0:1:n1

sigma(i+1)=factorial(n1)/(factorial(i)*factorial(n1-i)); % for calculating (x!/(y!(x-y)!)) values

end

l=[];

UB=[];

for u=0:0.002:1

for d=1:n

UB(d)=sigma(d)*((1-u)^(n-d))*(u^(d-1));

end

l=cat(1,l,UB);

end

P=l*p;

line(P(:,1),P(:,2))

line(p(:,1),p(:,2))

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Curve-Fit Function USING MATLAB Using the top-down design approach, develop a MATLAB function A8P2RAlastname.m that reads...
Curve-Fit Function USING MATLAB Using the top-down design approach, develop a MATLAB function A8P2RAlastname.m that reads data from a file and performs regression analysis using polyfit and polyval. The function shall have the following features: The input arguments shall include the file name (string), a vector of integers for the degrees of polynomial fits to be determined, and an optional plot type specifier (‘m’ for multiple plots, ‘s’ for a single plot - default). The data files will be text...
Part 1: Two Round Conductors Gather all items required for the exercise. Note: If using the...
Part 1: Two Round Conductors Gather all items required for the exercise. Note: If using the lab kit box, remove contents and place in a secure area. Put on your safety goggles. Center the black conductive paper on the top of the box, grid-side up. Place the two metal nuts (conductors) at the (5 cm, 10 cm) and (20 cm, 10 cm) positions on the paper. Secure using two dissection pins for each conductor. See Figure 13. Note: Place the...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how the firms resources incompetencies support the given pressures regarding costs and local responsiveness. Describe entry modes have they usually used, and whether they are appropriate for the given strategy. Any key issues in their global strategy? casestudy: Atlanta, June 17, 2014. Sea of Delta employees and their families swarmed between food trucks, amusement park booths, and entertainment venues that were scattered throughout what would...