0% found this document useful (0 votes)
25 views

Function: 'Bo-' 'Iterations' 'Number'

This MATLAB function takes in a start number and number of iterations as inputs. It generates two vectors x and y of the specified number of iterations by iterating from 1 to that number, with x containing the iteration numbers and y containing the start number divided by 2 for each subsequent iteration. It then plots x vs y with blue circles and a line, labels the axes, sets the x and y limits, and returns the final value of the start number.

Uploaded by

Hunter Patton
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Function: 'Bo-' 'Iterations' 'Number'

This MATLAB function takes in a start number and number of iterations as inputs. It generates two vectors x and y of the specified number of iterations by iterating from 1 to that number, with x containing the iteration numbers and y containing the start number divided by 2 for each subsequent iteration. It then plots x vs y with blue circles and a line, labels the axes, sets the x and y limits, and returns the final value of the start number.

Uploaded by

Hunter Patton
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

function final=MATH313_01_Patton_Hunter_prog6(strt, num)

x = zeros((num+1),1);
y = zeros((num+1),1);
lim=strt;
for i=1:(num+1),
x(i)=(i-1);
y(i)=strt;
strt=strt/2;
end
plot(x,y,'bo-')
xlabel('Iterations');
ylabel('Number');
xlim([-1 num+1]);
if(strt>0)
ylim([0 (lim+5)]);
else
ylim([(lim-5) 0]);
end
final=strt;
end

Published with MATLAB R2013a

You might also like