clear all close all mode = 0; % figure version %mode = 1; % demo version if (mode) phi = input('Phi in degrees: '); else phi = 20; end for phi = 0:5:360 phi phi = pi*phi/180; l = 2; % length of axes x = 1; y = 1; xp = x*cos(phi) + y*sin(phi); yp = x*sin(phi) - y*cos(phi); hold on figure(1) plot([-l,l],[0,0],'k-') % lab x-axis plot([0,0],[-l,l],'k-') % lab y-axis plot([0,x,0,x] ,[0, 0, y, y],'ko') % points in the rotated system plot([0,1,1],[1,1,0],'k--') % lab impulses plot([-l*sin(phi),l*sin(phi)],[l*cos(phi),-l*cos(phi)],'b-') % rotated axes plot([-l*cos(phi),l*cos(phi)],[-l*sin(phi),l*sin(phi)],'b-') % rotated axes plot(yp*sin(phi),-yp*cos(phi),'b*') % points in the rotated system plot(xp*cos(phi),xp*sin(phi),'b*') % points in the rotated system plot([yp*sin(phi),1,xp*cos(phi)],[-yp*cos(phi),1,xp*sin(phi)],'b--') % lab impulses axis off axis equal hold off if (phi < pi*20/180) pause else pause(0.5) end close(1) end