Question: In this exercise, you will be creating a function trough_error that will assign a message based on the input vector y. Note that we can

In this exercise, you will be creating a function trough_error that will assign a message based on the input vector y.

Note that we can assign a message by typing: message = 'type message here'

Function Process:

The initial value for y and the final value for y should be equal within a tolerance of 10-3. If they are not, the message should say 'Warning: Trough Area is invalid since shape does not close properly'. If the final y value is within tolerance, you should then check whether any of the other values in y (excluding the initial and final values) are greater than the initial value for y. If this condition is met, the message should be 'Warning: Trough Area will be incorrect since y exceeds y0 at a certain point'. If neither of these conditions are met, the message should be 'Trough Area is valid'.

Potentially Useful Functions: if, elseif, else, abs, max, end

Function Template

function message = trough_error(y) %insert code end

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!