Engr 297 Homework Set 5a Chapter 4 Part 2 Problem Set 20 Points Submit Scripts Problems 1 Q26953557
ENGR 297 Homework Set 5A Chapter 4 (Part 2) Problem Set (20 points Submit your scripts for all problems 1-5. 1. (5 points) Consider the array A shown below. -4 -8 -1 -9 Write a script that computes array B by computing the natural logarithm of all elements in A whose value is equal to or greater than 1 and adding 20 to those elements that are less than 1. Do this in two ways: a. Us a for loop with conditional statements b. Use a logical mask. Combine both a & b into one script file for a single upload Answer: (it will be repeated twice on the output, once for part a) and again for part b) 1.0986 1.6094 16.0000 12.0000 19.0000 3.4965 3.0000 1.7918 11.0000 Show transcribed image text ENGR 297 Homework Set 5A Chapter 4 (Part 2) Problem Set (20 points Submit your scripts for all problems 1-5. 1. (5 points) Consider the array A shown below. -4 -8 -1 -9 Write a script that computes array B by computing the natural logarithm of all elements in A whose value is equal to or greater than 1 and adding 20 to those elements that are less than 1. Do this in two ways: a. Us a for loop with conditional statements b. Use a logical mask. Combine both a & b into one script file for a single upload Answer: (it will be repeated twice on the output, once for part a) and again for part b) 1.0986 1.6094 16.0000 12.0000 19.0000 3.4965 3.0000 1.7918 11.0000