%% clear all close all clc cd c:\prog'ram Files'\simTK\Lab5\lab5\ [t y v e ydiff] = textread('NewtonsAppleResults.txt','','headerlines',1); yNoResistance = 10-4.9.*t.*t; vNoResistance = -9.8.*t; figure(1); plot(t,y) hold on; plot(t,yNoResistance,'r') xlabel('Time (s)') ylabel('Y (m)'); legend('With Air Resistance','Without Resistance'); figure; plot(t,v); hold on; plot(t,vNoResistance,'r'); xlabel('Time (s)'); ylabel('Velocity (m/s)'); legend('With Air Resistance','Without Resistance'); %% clear all close all clc cd c:\prog'ram Files'\simTK\Lab5\lab5\ [t x y e xdiff ydiff] = textread('ProjectileMotionResults.txt','','headerlines',1); x2 = linspace(0,200,1000); yNoResistance = tand(35).*x2-4.9./(44.7*cosd(35)).^2.*x2.^2; figure(1); plot(x,y); hold on; plot(x2,yNoResistance,'r'); axis([0 200 0 40]) xlabel('X (m)') ylabel('Y (m)'); legend('With Air Resistance','Without Resistance'); %% clear all close all clc cd c:\prog'ram Files'\simTK\Lab5\lab5\ [t x v e xdiff] = textread('NewtonsAppleResults.txt','','headerlines',1); plot(t,x) xlabel('Time (s)'); ylabel('X (m)'); %% clear all close all clc cd c:\prog'ram Files'\simTK\Lab5\lab5\ [t x v e xdiff] = textread('ControlResults0p4.txt','','headerlines',1); plot(t,x) xlabel('Time (s)'); ylabel('X (m)'); hold on; [t x v e xdiff] = textread('ControlResults0p2.txt','','headerlines',1); plot(t,x,'r') [t x v e xdiff] = textread('ControlResults1p0.txt','','headerlines',1); plot(t,x,'g') plot(t,2+sin(t),'k'); legend('wn = 0.4','wn = 0.2','wn = 1.0','desired trajectory');