converge - numi = round(numi); num = num + 1; vec = [vec...

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

View Full Document Right Arrow Icon
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 %usage: [vec num] = converge(numi) if numi>38 %this following function will only run if the original value is greater %than 38 vec=[]; num=0; while numi>38 numi = numi./3; numi = numi + 25;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: numi = round(numi); num = num + 1; vec = [vec numi]; %this while loop will take the number that is greater than 38 and %divide it by 3, then add 25 to the new number, and then round it;. .. %then this number will be placed in vec, while adding one to num each %time the loop is run; the loop will continue until numi is less than %38 end else num=0; vec=; %if the initial number is not greater than 38, then vec will be empty %and num will equal 0, because no value is placed in vec and the loop %has not run any times end end...
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