Lab 6 loops V2

.docx

School

California State University, Long Beach *

*We aren’t endorsed by this school

Course

205

Subject

Aerospace Engineering

Date

Apr 3, 2024

Type

docx

Pages

1

Uploaded by KidKookabura3563 on coursehero.com

California State University, Long Beach Mechanical and Aerospace Engineering Department MAE 205: Computer Methods in MAE Prof. M. Lackpour Spring 2020 Lab 6: Loop Due: End of class Write your final answer in the specified area. No credit will be given to illegible work. You can work in a team of up to 3 persons. Name: ___________________________________________________ Group #:_______ Score: _______/20 pts 1. [5 pts] Write a program in a script file that finds the smallest even integer that is divisible by 13 and by 16 whose square root is greater than 120. Use a loop in the program. The loop should start from 1 and stops when the number is found. The program prints the message “the required number is:” and then prints the number. 2. [5 pts] Fibonacci numbers are the numbers in sequence in which the first two elements are 0 and 1, and the value of each subsequent element is the sum of the previous two elements: 0,1,1,2,3,5,8,13…. Write a MATLAB program in a script file that determines and displays fist 20 Fibonacci numbers. 3. [5pts] Create an M-by-N array of random numbers (use rand). Move through the array, element by element, and set any value that is less than .2 to 0 and nay value that is greater than or equal to .2 to 1. 4. [5pts] write a script that uses the random numbers generator (rand) to determine the following: a. The number of random numbers it takes to add up to 20 (or more). b. The number of random numbers it takes before a number between .8 and .85 occurs. c. The number of random numbers it takes before the mean of those numbers is within .01 of .5 (the mean of this random number generator).
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help