% % calls up the power data for the upperarm and forearm % plots the data versus time and plots the 3 regions of the throw clear close all load plotcommandexamples.txt; file=plotcommandexamples(:,:); % columns of file = Frame, Time, EINTEG, PSUM % label the columns of the loaded file frame = file(:,1); time= file(:,2); Einteg= file(:,3); Psum= file(:,4); figure(2) % open figure window, number 2 clf % clear figure whitebg('g') % change background color pause whitebg([1,0.4,0.6]); pause whitebg('white') hold on plot(time,Einteg(:,:),'-r','LineWidth',3) plot(time,Psum(:,:) ,':b','LineWidth',3) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % LineWidth - specifies the width (in points) of the line % MarkerEdgeColor - specifies the color of the marker or the edge color for filled markers % (circle, square, diamond, pentagram, hexagram, and the four triangles). % MarkerFaceColor - specifies the color of the face of filled markers. % MarkerSize - specifies the size of the marker in points. % % Various line types, plot symbols and colors may be obtained with % PLOT(X,Y,S) where S is a character string made from one element % from any or all the following 3 columns: % % y yellow . point - solid % m magenta o circle : dotted % c cyan x x-mark -. dashdot % r red + plus -- dashed % g green * star % b blue s square % w white d diamond % k black v triangle (down) % ^ triangle (up) % < triangle (left) % > triangle (right) % p pentagram % h hexagram % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %format vertical lines % =line([xmin,xmax],[ymin,ymax]) zerohorz =line([-1.25,1],[0,0], 'LineWidth',1,'Color',[.1 .1 .1]); windup =line([-1.06,-1.06],[-300,350],'Linestyle',':','LineWidth',1,'Color',[.1 .1 .1]); accel =line([-0.36,-0.36],[-300,350],'Linestyle',':','LineWidth',1,'Color',[.1 .1 .1]); release =line([0,0],[-300,350], 'Linestyle','-','LineWidth',1,'Color',[.1 .1 .1]); followthrough=line([0.32,0.32],[-300,350], 'Linestyle',':','LineWidth',1,'Color',[.1 .1 .1]); % format plot ie. axis, legend, text, title pause % note the limits to the x and y axis, not very pleasing to the eye eh? axis tight % ahhh, much better. pause XLim([-.5 .5]) % specify limits to X axis YLim([-300 350]) % specify limits to X axis %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % axis commands include... (there are many many more) % axis tight.... sets the axis limits to the range of the data. % axis equal.... sets the aspect ratio so that the data units are the same in every direction. % axis([xmin,xmax,ymin,ymax]).... sets the limits for the x- and y-axis of the current axes. % use the MATLAB variable Inf or -Inf for the autoscaled limit. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% legend('Energy','Power') % create a legend box in figure xlabel('time (s)','fontsize',10,'fontangle','italic','fontweight','bold','color','yellow') % ylabel(..same sort of stuff..) title('Figure 1','fontsize',15,'fontangle','italic','fontweight','bold','color','cyan') % text(xlocation, ylocation, 'your text', 'other specifications') text(-1.06,320,' \leftarrow windup \rightarrow','FontSize',10) text(-.26,320,' acceleration','FontSize',10) text(0.07,320,' follow through','FontSize',10) text(-.16,-270,' release^1 \rightarrow','FontSize',10) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % MATLAB Function Reference: Text Properties % % FontAngle {normal} | italic | oblique % FontName A name such as Courier or the string FixedWidth % FontSize size in FontUnits % FontWeight light | {normal} | demi | bold % % Specifying Subscript and Superscript Characters % The subscript character "_" and the superscript character "^" modify the character or % substring defined in braces immediately following. % % To print the special characters used to define the Tex strings when Interpreter is Tex, % prefix them with the backslash "\" character: \\, \{, \} \_, \^. % % \alpha \upsilon \sim % \beta \phi \leq % \gamma \chi \infty % \delta \psi \clubsuit % \epsilon \omega \diamondsuit % \zeta \Gamma \heartsuit % \eta \Delta \spadesuit % \theta \Theta \leftrightarrow % \vartheta \Lambda \leftarrow % \iota \Xi \uparrow % \kappa \Pi \rightarrow % \lambda \Sigma \downarrow % \mu \Upsilon \circ % \nu \Phi \pm % % \bf - bold font % \it - italics font % \sl - oblique font (rarely available) % \rm - normal font % \fontname{fontname} - specify the name of the font family to use. % \fontsize{fontsize} - specify the font size in FontUnits. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %more examples.... hip hip hooray! x = -pi:.1:pi; y = sin(x); figure(3) subplot(2,1,1) % subplot(m,n,p) ...divides the current figure into m x n figures/panes, % p specifies position of current plot % Subsequent plots are output to the current pane. plot(x,y) set(gca,'XTick',-pi:pi/2:pi) set(gca,'XTickLabel',{'-pi','-pi/2','0','pi/2','pi'}) xlabel('-\pi \leq \Theta \leq \pi') ylabel('sin(\Theta)') title('Plot of sin(\Theta)') text(-pi/4,sin(-pi/4),'\leftarrow sin(-\pi\div4)','HorizontalAlignment','left') set(findobj(gca,'Type','line','Color',[0 0 1]),'Color',[0.5,0,0.5],'LineWidth',2) t = 0:pi/20:2*pi; subplot(2,1,2) plot(t,sin(2*t),'-mo',... 'LineWidth',2,... 'MarkerEdgeColor','k',... 'MarkerFaceColor',[.49 1 .63],... 'MarkerSize',12)