1 / 14

Computer Simulation Lab

Computer Simulation Lab. “Lecture 9”. Electrical and Computer Engineering Department SUNY – New Paltz. More graphics. Objectives • Handle Graphics; • editing plots; • animation; • saving and exporting graphs. Object Handle. h1=figure plot(x) h2=figure plot(y) figure(h1)

soyala
Télécharger la présentation

Computer Simulation Lab

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Simulation Lab “Lecture 9” Electrical and Computer Engineering Department SUNY – New Paltz SUNY-New Paltz

  2. More graphics Objectives • Handle Graphics; • editing plots; • animation; • saving and exporting graphs SUNY-New Paltz

  3. Object Handle h1=figure plot(x) h2=figure plot(y) figure(h1) xlabel(’x’) SUNY-New Paltz

  4. Graphic Handles x = 0:pi/20:2*pi; hsin = plot(x, sin(x)) hold on hx = xlabel(’x’) handle of the Line object handle of the Text object SUNY-New Paltz

  5. functions that return the handle of particular graphics objects • gcf: gets the handle of the current figure, • gca: gets the handle of the current axes. • gco: gets the handle of the current graphics object SUNY-New Paltz

  6. Graphics object properties and how to change them set(hsin,’linewidth’,4); x=0:pi/20:2*pi; hsin=plot(x,sin(x)) SUNY-New Paltz

  7. “get(hsin)” CreateFcn = DeleteFcn = BusyAction = queue HandleVisibility = on HitTest = on Interruptible = on Parent = [100.001] Selected = off SelectionHighlight = on Tag = Type = line UIContextMenu = [] UserData = [] Visible = on Color = [0 0 1] EraseMode = normal LineStyle = - LineWidth = [4] Marker = none MarkerSize = [6] MarkerEdgeColor = auto MarkerFaceColor = none XData = [ (1 by 41) double array] YData = [ (1 by 41) double array] ZData = [] BeingDeleted = off ButtonDownFcn = Children = [] Clipping = on SUNY-New Paltz

  8. Editing plots x = 0:pi/20:2*pi; hsin=plot(x,sin(x)) Tools -> Edit Plot SUNY-New Paltz

  9. SUNY-New Paltz

  10. Animation for k = 1:16 plot(fft(eye(k+16))) axis equal M(k) = getframe; pause; end movie(M, 5) SUNY-New Paltz

  11. Animation with Handle Graphics x = 0; y = 0; dx = pi/40; p = plot(x, y, ’o’, ’EraseMode’, ’none’); % ’xor’ shows only current point % ’ none’ shows all points axis([0 20*pi -2 2]) for x = dx:dx:20*pi; x = x + dx; y = sin(x); set(p, ’XData’, x, ’YData’, y) drawnow end SUNY-New Paltz

  12. Saving and opening figure files • Select Save from the figure window File menu. • Make sure the Save as type is .fig. • To open a figure file select Open from the File menu SUNY-New Paltz

  13. Printing a graph • To print a figure select Print from the figure window File menu. • If you have a black and white printer, colored lines and text are ‘dithered to gray’ which may not print very clearly in some cases. In that case select Page Setup from the figure File menu. Select the Lines and Text tab and click on the Black and white option for Convert solid colored lines to: SUNY-New Paltz

  14. Exporting a graph Select Copy Figure from the figure window’s Edit menu • Select Export from the figure’s File menu. This action invokes the Export dialogue box. • Select a graphics format from the Save as type list, e.g. EMF (enhanced metafiles), JPEG, etc. SUNY-New Paltz

More Related