Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "SUNY-New Paltz Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz “Lecture 9”"— Presentation transcript:

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

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

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

4 SUNY-New Paltz 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

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

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

7 SUNY-New Paltz “get(hsin)” 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 CreateFcn = DeleteFcn = BusyAction = queue HandleVisibility = on HitTest = on Interruptible = on Parent = [100.001] Selected = off SelectionHighlight = on Tag = Type = line UIContextMenu = [] UserData = [] Visible = on

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

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)

11 SUNY-New Paltz 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

12 SUNY-New Paltz 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

13 SUNY-New Paltz 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:

14 SUNY-New Paltz 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.


Download ppt "SUNY-New Paltz Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz “Lecture 9”"

Similar presentations


Ads by Google