Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(12) Create a random vector of birthdays with the following command: class_bdays = randi (365, [1, 20]); Make a comment after this line of

(12) Create a random vector of birthdays with the following command: class_bdays = randi (365, [1, 20]); Make a comment after this line of code that describes what it accomplished. Create a for loop that will look at each element of the vector class_birthdays and determine the day of the year on which the first birthday occurs. Assign this value to a variable named first_bday. Also assign the index for which this occurs to a variable named ind_1st_bday (12) Create a for loop that will calculate the sum of the squares of the first n odd numbers and assign the result to sum_odd_sqrs. It should give the same result as performing the following by hand: sum_odd_sqrs = 12 +32 +52 + 72 + ... + (2n-1) 2 Hint: Set up your loop such that the index will be the odd numbers that you want to square and add up.

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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

Students also viewed these Programming questions