Hide menu

TDDD34 Programming with Applications in Engineering

Figures, plots and graphs in Matlab


This document describes how to draw and plot in a separate figure window. The figure window frequently appear below other windows, be prepared to bring it to top manually.

Functions and operators

	plot		Plots (graphically) data in a separate figure window.

	plot3		Plots in 3D.

        axis            Configures range and relative scale of the axes
                        in the figure window.
        
	hold		Decide if the next plot should keep or clear the
                        contents of the figure window. (By default new
                        plots erases any previous plots.)
	
	clf		Clears the figure window.

	figure		Opens a new figure window and focuses it.
	figure(x)	Moves focus to the existing window x.

	semilogx	Plot with logarithmic scale on x axis.

	semilogy	Plot with logarithmic scale on y axis.

	loglog		Plot with logarithmic scale on both axes.

	grid		Draws a grid in the figure window.

	imagesc		Draws colored squares in the figure window based
                        on the contents of a matrix.

A lot of more interesting and useful details can be said of the above commands. You can for example plot with different colors, lines and sizes. Be prepared to use Matlabs built-in help command (try "help help"). When you know how to use the built-in help, use it on all above commands to take a quick look on what you can do.


Page responsible: Erik Nilsson
Last updated: 2012-08-07