Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Vector of Random Numbers (practice your FOR loops!) If you use the MATLAB function rand(1), it generates a random number between 0 and 1.

image text in transcribed

1. Vector of Random Numbers (practice your FOR loops!) If you use the MATLAB function rand(1), it generates a random number between 0 and 1. That is, if you use the command xrand(1) then x is a random number between 0 and 1, and every time it is called, x would be a different random number (a) Use a "for loop" and the function rand(1) to create a vector x(n) with 500 elements. Then compute the average value of the elements in x (b) Use another "for loop" and rand(1) to create a vector y(n) of 500 random numbers between the numbers -2 and +2. 2. Leap Year Program (practice your IF statements!) Write a code to determine if a year is considered a leap year or not? Display to the screen if the year is a leap year or not. Use num2str() and display() or fprintf In the Gregorian calendar three criteria must be taken into account to identify leap years: The year is evenly divisible by 4 (Exceptions 1700, 1800, and 1900); If the year can be evenly divided by 100, it is NOT a leap year, unless; The year is also evenly divisible by 400. Then it is a leap year

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

1 2 3 Data Base Techniques

Authors: Dick Andersen

1st Edition

0880223464, 978-0880223461

More Books

Students also viewed these Databases questions

Question

Question 1 (a2) What is the reaction force Dx in [N]?

Answered: 1 week ago

Question

What lessons in OD contracting does this case represent?

Answered: 1 week ago

Question

Does the code suggest how long data is kept and who has access?

Answered: 1 week ago