Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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)

image text in transcribed
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

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

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions