RecursiveSum HW9 - elements and returns the sum as a scalar If the input is an empty vector the function should return 0 function out =

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

View Full Document Right Arrow Icon
% 10/14/2009 % Function Name: recursiveSum % Inputs: 1.(Double) Vector of numbers. % Outputs: 1.(Double) Sum of the elements in the input vector % % Function Description: % This function takes in a vector of doubles, RECURSIVELY adds its
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % elements and returns the sum as a scalar. If the input is an empty % vector the function should return 0. function out = recursiveSum(in) if isempty(in) out = 0; else out = in(1) + recursiveSum(in(2:end)); end...
View Full Document

This note was uploaded on 10/22/2009 for the course CS 1371 taught by Professor Stallworth during the Fall '08 term at Georgia Institute of Technology.

Ask a homework question - tutors are online