Places for numbers in the format string are specified

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: tring are specified like: %-12.5e %{+,%{+,-,0}{field width}.{precision}{conversion} +: include sign, -: left justify, 0: pad with zeros Making Your Own MATLAB Functions You can use an M-File to create a new function MThe syntax for defining a MATLAB function is: function [outputs] = functionname (inputs) [outputs] (inputs) % H1 Line % Help text % Help text Body Subfunctions You can actually have more than one function defined in your function .m file The first defined function is the primary function and should represent the name of the file Each subsequent function is called a subfunction and can be typed in any order Subfunctions Each subfunction has its own scope and local variables Each subfunction can call the primary and other subfunctions from within the current function file Other function/script files can only call the primary function MATLAB Functions There are a large number of predefined mathematical functions in MATLAB. If you apply a function defined for a scalar value to a vector or matrix, the function is applied to each value. x = [ 0 0.5*pi pi 1.5*pi 2.0*pi ]; y =...
View Full Document

This note was uploaded on 05/04/2010 for the course ENGIN 101 taught by Professor Jeffringenberg during the Spring '07 term at University of Michigan.

Ask a homework question - tutors are online