function drawcar % % we will use splines to draw the % profile of a car % x = [1.0 1.8 4.0 4.8 6.8 7.6 8.8 9.4]; y = [1.5 2.0 2.1 2.5 2.5 2.2 2.0 1.5]; plot(x,y) axis([0 10 0 4]); xx = 1:0.2:9.4; yy = spline(x,y,xx); hold on plot(x,y,'o',xx,yy); t = 0:0.1:2*pi; plot(2.5+0.5*cos(t),1.5+0.25*sin(t)); for k = 0.1:0.05:0.8 plot(2.5+0.5*k*cos(t),1.5+0.25*k*sin(t)); end;