Question: Problem 32. Write a function called trim10 that takes two vectors of the same length as input arguments (it does not have to check the

 Problem 32. Write a function called trim10 that takes two vectors

Problem 32. Write a function called trim10 that takes two vectors of the same length as input arguments (it does not have to check the format of the input) and returns two row vectors of the same length as the input vectors. If it is called like this, v trimmed,trimmings]trim10 (v1,v2), then v_trimmed is identical to vl except that every element vl (ii) that is greater than v2 (ii)+10 must be trimmed, which means that it must be replaced by v2 (ii) +10. Each element of trimmings is equal to the amount by which each element has been trimmed. The function must use logical indexing instead of explicit looping. Here is an example of the function being used: >> vl v1= 36 26 4 17 -100 90 >>v2 34 15-200 6 80 >> [vtrimmed, trimming]-trim10 (vl, v2) v trimmed = 36 25-10 10 -100 90 trimming - 0 1 14 7 0 0

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!