% this replaces x with abs(x) if (x < 0) x = -x; end x function Myfib(n) A0 = 0; A1 = 1; for i = 2:n An = A0 + A1; A0 = A1; A1 = An; end Mystring = ['The ', num2str(n),'th Fibonacci number is: ',num2str(An)]; disp(Mystring); function Myfibold(n) A(1) = 0; A(2) = 1; for i = 1:n-1 A(i+2) = A(i+1) + A(i); end Mystring = ['The ', num2str(n),'th Fibonacci number is: ', num2str(A(i+2))]; disp(Mystring); function Myfun(x,y) x^y % this script is an example of a while loop n = 0; tic while (x ~= 2) x = x+1; n = n+1; end x n toc