Question: Problem 2 (35 points, to be done entirely in Matlab): Write a function, which computes volume and surface of a sphere. The function must: a)

 Problem 2 (35 points, to be done entirely in Matlab): Write

Problem 2 (35 points, to be done entirely in Matlab): Write a function, which computes volume and surface of a sphere. The function must: a) take the radius of the sphere R as an input b) compute the volume V = nR and surface area S = 48 R2 c) print and Son the screen with proper text (for example, "The volume is...) d) return V and S as output parameters Test the function with R = 12.5. Problem 3 (50 points, to be done entirely in Matlab): Write a script, which a) Creates an array x of 1000 random numbers uniformly distributed on the interval from 0 to 5 b) Calculates the sum of all elements, which are smaller than 2.0 c) Sets all elements of the array, which are larger than or equal to 2.0. to zero Extra credit problem (10 points): Write a function that a) takes an array x of an arbitrary length as an input parameter b) asks for a number a to be entered from screen c) calculates how many elements of x are smaller than a and how many elements of x are larger than a and prints these two numbers Test the function on an array of random numbers of length 1000

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!