function [] = BallDisplay(x) % ECE 463 Lecture #6 % display for ball rolling in a bowl y = x*x; x1 = [-2:0.01:2]'; y1 = x1 .^ 2; % draw the ball i = [0:0.01:1]' * 2 * pi; xb = 0.05*cos(i) + x; yb = 0.05*sin(i) + x^2 + 0.05 + 0.05*abs(x); % line through the ball q = [0, pi] - x*(1+abs(x))/0.05; xb1 = 0.05*cos(q) + x; yb1 = 0.05*sin(q) + x^2 + 0.05 + 0.05*abs(x); plot(x1,y1,'b', xb, yb, 'r', xb1, yb1, 'r'); end