WS2 Tutorial 2 Exercises

WS2 Tutorial 2 Exercises

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: X and Y (i.e., 100 times) A(i) = X(i) + Y(i); % add elements and store in A end for i = 1:100 % for every element of A and Z (i.e., 100 times) B(i) = A(i)/Z(i); % divide A by Z and store in B end 4. The Fibonacci sequence is a sequence of numbers in which a number is the sum of the previous two numbers, excluding the first two numbers (which are 0 and 1). Create a function named “fibonacciSequence” that takes one input: how many numbers in the Fibonacci sequence you want to calculate, and returns that sequence. Remember, the sequence ALWAYS starts with 0 1. For example, fib = fibonacciSeq...
View Full Document

This document was uploaded on 03/18/2014 for the course ENGE 1104 at Virginia Tech.

Ask a homework question - tutors are online