Question: Write all answers in MATLAB 1. Write a script that computes the first 100 Fibonacci numbers. The Fibonacci numbers are computed like this: the next
Write all answers in MATLAB 1. Write a script that computes the first 100 Fibonacci numbers. The Fibonacci numbers are computed like this: the next number is the sum of the previous two numbers. So if the first two numbers are ,), then the third number is 2 1 1, the fourth number is 3 12, the fifth is 5-2+3, and so on: 1,2,3, 5,8,13,2..J. Formally, we say that for each i, 2. Write a function called myFactorial (n) that takes in one argument, n, and returns n! (that is, n-factorial). Recall that n! is the product of all the integers up to n; so 5!-1-2.3.4.5 120. MATLAB Basics April 19, 2018 You can use the built-in MATLAB function factorial (n) to check your work, but don't call factorial(n in your function. 3. Run the command testVec = rand (1000,1) ;. This will create a vector with 1000 random numbers (between 0 and Write a function that takes in this vector and returns the smallest element. You can use the built-in function min) to check your work, but don't call min) in your function. 4. Now, run the command testMat rand (1000, 1000). This creates a 1000x1000 matrix full of random numbers. Write a function that takes in this matrix and returns the smallest element. 5. Write a function like in Exercise 4, but this time make it so it can find the smallest element in a matrix of any size. Hint: look up help on the built-in function size)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
