Question: Given a user specified constant . Write a program (you can use MATLAB/Octave or Python) that will find the nearest to value and the corresponding
Given a user specified constant . Write a program (you can use MATLAB/Octave or Python) that will find the nearest to value and the corresponding index of the element from an array. Use the following data (for MATLAB) to test your program: = [ 0 1 2 3 4 5 6 7 8 9 10 ]; = 4.3; Please use only basic operators like assignment, comparison, conditional statement, and loops. Do not use built in functions or advanced possibilities of a specific programming language (e.g. vectorization in MATLAB)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
