Problem 5. Triangle Numbers function t = triangle(n) t=0; for i=1:n t=t+i; end end Problem 1035. Generate a vector like 1,2,2,3,3,3,4,4,4,4 function ans = your_fcn_name(x) ans=[]; for i=1:x b=repmat(i,1,i); ans=[ans b]; end end Problem 23. Finding Perfect Squares function b = isItSquared(a) for i=1:length(a) if ~isempty(find(a==(a(i))^2)) b = true; break else b = false; end end end Problem 1702. Maximum value in a matrix function y = your_fcn_name(x) y = max(max(x)); end Problem 1744. Make a Plot with Functions function h = makeAPlot(x,y,color) h=plot(x,y,color) ; end Problem 12. Fibonacci sequence function f = fib(n) if n == 1 || n == 2 f = 1; else f = fib(n-1) + fib(n-2); end Problem 3056. Chess probability function y = expected_score(elo1,elo2) a=(1+10^((elo2-elo1)/400))^(-1); y=round(a,3); end Problem 174. Roll the Dice! function [x1,x2] = rollDice() x1 = randperm(6,1); x2 = randperm(6,1); end Problem 1087. Magic is simple (for beginners) function m = magic_sum(n) a=magic(n); m=max(sum(a)); end Problem 233. Reverse the vector function y = reverseVector(x) y=x(end:-1:1); end