% shows 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]); % we smoothen the profile of the car % using splines: xx = 1:0.2:9.4; % sampling range for spline yy = spline(x,y,xx); figure hold on plot(x,y,'o',xx,yy); axis([0 10 0 10]); % we will draw some wheels t=0:0.01:2*pi; plot(2.5+0.5*cos(t),1.5+0.5*sin(t)); for k = 0.1:0.05:0.8 plot(2.5+0.5*k*cos(t),1.5+0.5*k*sin(t)); end; plot(8.0+0.5*cos(t),1.5+0.5*sin(t)); for k = 0.1:0.05:0.8 plot(8.0+0.5*k*cos(t),1.5+0.5*k*sin(t)); end;