Question: Matlab code files ( two) please Write a function, called signSwitch, in a separate file which inputs a vector v and outputs a vector with
Matlab code files ( two) please
Write a function, called signSwitch, in a separate file which inputs a vector v and outputs a vector with the indices which represent a sign change in v; i.e. report 15 if the sign changed in v between index 14 and index 15. Do not consider going from positive or negative to zero. We could loop through and check this condition at every point - don't do that. Instead think of a way to use logical indexing: One suggestion is to write conditions on the vector and some kind of shifted version of itself. Beware however, when you do this you will have non-overlapping points. It is up to you to figure out what to with them. This will be a local function (see the documentation if you forgot what this means). Now we will write the main function, call it whatever you'd like, which will perform all the analysis. The function will input two vectors representing the x and y coordinates of the graph of the function and will return a vector with the approximate indices of the local extrema and a vector with the approximate indices of the points of inflection. Write a function, called signSwitch, in a separate file which inputs a vector v and outputs a vector with the indices which represent a sign change in v; i.e. report 15 if the sign changed in v between index 14 and index 15. Do not consider going from positive or negative to zero. We could loop through and check this condition at every point - don't do that. Instead think of a way to use logical indexing: One suggestion is to write conditions on the vector and some kind of shifted version of itself. Beware however, when you do this you will have non-overlapping points. It is up to you to figure out what to with them. This will be a local function (see the documentation if you forgot what this means). Now we will write the main function, call it whatever you'd like, which will perform all the analysis. The function will input two vectors representing the x and y coordinates of the graph of the function and will return a vector with the approximate indices of the local extrema and a vector with the approximate indices of the points of inflection
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
