lab10tasks - ENGR 12600 Fall 2008 Laboratory 10 Task 1...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
ENGR 12600 – Fall 2008 Task 1 Laboratory 10 Task 1 – User-Defined Function (Estimated Time = 20 minutes) You will write a user-defined function that calculates the average of a vector. o The input argument for the function will be a vector. o The output argument will be the average of the vector. o The code will calculate the average using the SUM() and LENGTH() functions. A. Create a user-defined function named vector_avg . 1. Create an M-file named vector_avg.m . 2. On the first line, write the function definition. The general format is: function [output variables] = function_name(input variables) for example: function [average_value] = vector_avg(my_vector) 3. Immediately following the function definition, add comment lines that help a user learn how to implement your user-defined function. You should clearly list all required input and output arguments with comments that explain each. Use the following format: % FUNCTION NAME Very brief purpose of function on this line % INPUT ARGUMENTS: % List them here one line per input argument % OUTPUT ARGUMENTS: % List them here one line per output argument 4. Following the help lines written in step #3 above, insert a completely blank line, and follow this with additional comment lines providing your identification information (including ENGR 126 lab and team affiliations) and the dates of beginning, completing, and modifying (if needed) the
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/12/2012 for the course ENGR 126 taught by Professor Oakes during the Fall '08 term at Purdue University-West Lafayette.

Page1 / 3

lab10tasks - ENGR 12600 Fall 2008 Laboratory 10 Task 1...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online