Menu

[Solved] 20 Points Write Matlab Function Called Validatelnputrange Following Form 2 Nge Prompt Minv Q37214400

(20 points) Write a MATLAB function called validatelnputRange with the following form: 2. nge(prompt,minval,maxVal) function

(20 points) Write a MATLAB function called validatelnputRange with the following form: 2. nge(prompt,minval,maxVal) function tvalue] – validateinputRa end This function is used to validate that a user input is within a certain range, using the method employed in cl this semester, so that you don’t have to duplicate similar code for every input value. The function argument are defined as follows: Input 1: promptThe text string to show to the user The smallest input that should be considered valid The largest input that should be considered valid The (validated) value that the user entered Input 2: ial naxval Input 3 . Output 1: value This function should use the while loop based input validation technique used in class to ensure that the user inputs a value between minVal and maxVal (inclusive). If the user enters an invalid value the error message shown in the example run should be displayed and the prompt should re-appear. Example Runs (your command line should look exactly like this when run with the some inputs): >> tenp#vaudateľnputRange(“Enter the water temperature [c] : ,,a,le) Enter the water temperature [cl: -50 value must be between 8.000008 and 100.000000 Enter the water tenperature [c]: 150 Value nust be between 8.aea080 and 100.980000 Enter the water tenperature [ci: 4s.2 45.2000 >> text = ‘Enter the angle in radians: ,; angle validateInputRangeltext,-2spi,2 pi) Enter the angle in radians: 18 Vatue must be between -6.283185 and 6.283185 Enter the angle in radians: 3.51 angle 3.5180 >> angle·validateľnputRange (text,-2*pi,2*p1) Enter the angle in radians: 3.51 ang le a 3.5188 Show transcribed image text (20 points) Write a MATLAB function called validatelnputRange with the following form: 2. nge(prompt,minval,maxVal) function tvalue] – validateinputRa end This function is used to validate that a user input is within a certain range, using the method employed in cl this semester, so that you don’t have to duplicate similar code for every input value. The function argument are defined as follows: Input 1: promptThe text string to show to the user The smallest input that should be considered valid The largest input that should be considered valid The (validated) value that the user entered Input 2: ial naxval Input 3 . Output 1: value This function should use the while loop based input validation technique used in class to ensure that the user inputs a value between minVal and maxVal (inclusive). If the user enters an invalid value the error message shown in the example run should be displayed and the prompt should re-appear. Example Runs (your command line should look exactly like this when run with the some inputs): >> tenp#vaudateľnputRange(“Enter the water temperature [c] : ,,a,le) Enter the water temperature [cl: -50 value must be between 8.000008 and 100.000000 Enter the water tenperature [c]: 150 Value nust be between 8.aea080 and 100.980000 Enter the water tenperature [ci: 4s.2 45.2000 >> text = ‘Enter the angle in radians: ,; angle validateInputRangeltext,-2spi,2 pi) Enter the angle in radians: 18 Vatue must be between -6.283185 and 6.283185 Enter the angle in radians: 3.51 angle 3.5180 >> angle·validateľnputRange (text,-2*pi,2*p1) Enter the angle in radians: 3.51 ang le a 3.5188

Expert Answer


Answer to (20 points) Write a MATLAB function called validatelnputRange with the following form: 2. nge(prompt,minval,maxVal) func… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *