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

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
Background image of page 1
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

Ask a homework question - tutors are online