100% found this document useful (2 votes)
6K views

Bezier Curve Plot in Matlab

This document provides instructions for plotting a cubic Bezier curve in MATLAB. It recommends two textbooks for learning about Bezier curves and MATLAB basics. It then shares MATLAB code to define four control points, calculate the Bezier geometric and basis transformation matrices, and plot both the control polygon and resulting Bezier curve.

Uploaded by

Chetan Swaroop
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
6K views

Bezier Curve Plot in Matlab

This document provides instructions for plotting a cubic Bezier curve in MATLAB. It recommends two textbooks for learning about Bezier curves and MATLAB basics. It then shares MATLAB code to define four control points, calculate the Bezier geometric and basis transformation matrices, and plot both the control polygon and resulting Bezier curve.

Uploaded by

Chetan Swaroop
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Dear Friends, This text is for the Students studying CAD.

To plot a Cubic Bezier Curve in MATLAB, you need to learn how to plot a Bezier Curve in matrix form and basics of MATLAB. You may refer following books for clearing your doubts Basics of Bezier curve- GEOMETRIC MODELING by Michael E. Mortenson, Jhon Wiley Publication. Basics of MATLAB- MATLAB An Introduction with Application by Amos Gilat, Jhon Wiley Publication. Best Wishes, Chetan Swaroop M. Tech. (Mechanical Engineering)

MATLAB Codes
clc;clf;clear all; axis equal;grid on; xlabel u;ylabel Pu; %plotting a Cubic Bezier curve %defining four control points p0, p1, p2 & p3 four arbitrary points p0 = [0 0 0]'; p1 = [1 1 0]'; p2 = [3 -1 0]'; p3 = [4 0 0]'; % defining Bezier Geometric Matrix B B = [p0 p1 p2 p3]'; % Bezier Basis transformation Matrix M M = [-1 3 -3 1; 3 -6 3 0; -3 3 0 0; 1 0 0 0]; % Calcutaion of Algebric Coffecient Matrix A A = M*B; % defining u axis u = linspace(0,1,50); u = u'; unit = ones(size(u)); U = [u.^3 u.^2 u unit]; % calculation of value of function Pu for each value of u Pu = U*A; %plotting control polygon line(B(:,1), B(:,2), B(:,3)) hold on; % plotting Bezier curve plot3(Pu(:,1), Pu(:,2), Pu(:,3),'r','linewidth',1.0) legend('Polygon','Bezier Curve')

You might also like