converge

converge - %usage[vec num = converge(numi if...

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

function [vec num] = converge(numi) %function to take in an input, divides it by three, adds 25, rounds it, and %then adds it to a vector to be returned; it should only do this if the %input number is greater than 38; furthermore, it should keep doing this %until the number is no longer greater than 38; the second output is a %number of times this process is repeated
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: %usage: [vec num] = converge(numi) if numi>38 %this following function will only run if the original value is greater %than 38 num=0; while numi>38 numi = numi./3; numi = numi + 25; numi = round(numi); vec = [numi]; num = num + 1; %this while loop will take the number that is greater than 38 and %divide it by 3, then add 25 to the new number, t...
View Full Document

This note was uploaded on 10/21/2010 for the course CS 1371 taught by Professor Stallworth during the Spring '08 term at Georgia Tech.

Ask a homework question - tutors are online