function [] = GantryDisplay(X, Xe, Ref) % Start with displayint the observer in cyan x = Xe(1); q = Xe(2); L = 1.3; % cart xc = [-0.2,0.2,0.2,-0.2,-0.2] + x; yc = [0,0,0.2,0.2,0]; xm = x + L*sin(q); ym = 0 - L*cos(q); % ball q = [0:0.1:1]' * 2*pi; xb = 0.05*cos(q) + xm; yb = 0.05*sin(q) + ym; plot([-3,3],[0,0],'b-',xc, yc,'c-',[x,xm],[0,ym],'c-',xb, yb, 'c-',[Ref, Ref],[-0.1,0.1],'b') ylim([-1.6,0.5]); hold on % Display the plant in red x = X(1); q = X(2); L = 1.3; % cart xc = [-0.2,0.2,0.2,-0.2,-0.2] + x; yc = [0,0,0.2,0.2,0]; xm = x + L*sin(q); ym = 0 - L*cos(q); % ball q = [0:0.1:1]' * 2*pi; xb = 0.05*cos(q) + xm; yb = 0.05*sin(q) + ym; plot([-3,3],[0,0],'b-',xc, yc,'r-',[x,xm],[0,ym],'r-',xb, yb, 'r-',[Ref, Ref],[-0.1,0.1],'b') ylim([-1.6,0.5]); pause(0.01); hold off end