ENGR13200_Sp2012_ICA05A_Problems

ENGR13200_Sp2012_ICA05A_Problems - ENGR 13200 Spring 2012...

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

View Full Document Right Arrow Icon
ENGR 13200 – Spring 2012 Activity 1 Class 5a In Class Activities : Completed in-class activity documents must be uploaded to your Instructor’s Blackboard ICA# Dropbox prior to the next class . All uploads must be done individually even if you worked with a partner. Partner names should appear in all documents that were worked with one or more partners. Completion of activities is part of the in-class participation grade and submissions may be subject to grading. Class5a : Upload c5a_vector_avg.m , c5a_STtoSI.m and c5a_asin_check.m . Activity 1 – User-Defined Function 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. Open function_header_template.m in the MATLAB editor and re-save as c5a_vector_avg.m. This will become the user-defined function c5a_vector_avg . 1. On the first line, before the help lines provided in the function_header_template.m file, write the function definition. The general format is: function [output variables] = function_name(input variables) for example: function [average_value] = vector_avg(my_vector) 2. Immediately following the function definition, edit the comment lines that describe authorship and 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 % INPUTS: List them below one line per input argument % % OUTPUTS: List them below one line per output argument % Save your function file and check that you have provided proper help comments by typing help c5a_vector_avg at the MATLAB prompt. (Your identification and date information and all help information should be echoed in the command workspace.) 3.
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.

Page1 / 4

ENGR13200_Sp2012_ICA05A_Problems - ENGR 13200 Spring 2012...

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