Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a MATLAB function that plots with fplot a mathematical function with limits for x determined according to the instructions below. The function should be
Create a MATLAB function that plots with fplot a mathematical function with limits for x determined according to the instructions below. The function should be implemented in the auto_fplot.in file provided Output = auto_fplot (func) Inputs: a mathematical function in x in symbolic form (fine) Output: a cell array as described below. This auto_fplot function should meet the following requirements. 1) After the mathematical function has been plotted, the auto_fplot function should be able to plot a set of interesting points (i.e. local maxima, local minima, inflection points, and two points for each vertical asymptote) for as many types of functions as possible. These should work for any polynomial equation. Vertical asymptotes should work for any rational function. All local maxima should be indicated with red circles, all local minima should be indicated with green circles and all inflection points should be indicated with blue circles. Vertical asymptotes should be indicated with black 'x's on the bottom and top borders (the fplot function of MATLAB draws dashed lines for the vertical asymptotes automatically). Each type of point must be drawn in that order if that type of point exists for the mathematical function. For each type, all points of that type must be plotted all at once and only if at least one point of that type exists. The "region of interest" or "domain of interest" (1.e. portion between the two extreme " interesting points if there is a finite number of such points) should be in the middle and occupy 70% of the x limits of the plot. If there is no interesting point found (or an infinite number of interesting points), plot the mathematical function and set the limits of x to be from -20 to 20 r. And if there is only one interesting point, interesting, then set the limits of x to be from (Xinteresting 20 ) to interesting + 20 ). Function auto_fplot retuns the following: Output = {fplotH; ImaxPlot, IminPlot; inflPlot; verAsymPlotBottom}; where fplotH returns the function line object retuned for the plot of f(x), and the other objects are the lineseries/line objects retuned for the plots of the local maxima, local minima, inflection points, and the bottom markers for vertical asymptotes. 2) The mathematical function as a title, axes labels (1.e., *x for x axis and 'f(x)' for y axis) and legend (.e., f(x)', 'Local Maxima', 'Local Minima', 'Inflection Points', and 'Vert. Asymptotes' as needed) should be included in the plot. Please make sure all your strings match these instructions. Only include in the legend those types of interesting points that exist for the mathematical function being plotted. These legend entries should be shown as plural even if there is only one point of a certain type. 3) Please complete the help comments at the top of the file. Do not modify the characters Boutput = AUTO_FPLOT (f" before the "..." Bonus requirements: 4) Can you include the location of any horizontal asymptotes? A left horizontal asymptote can be plotted as a green 'x' on the left border, and a night horizontal asymptote can be plotted as a red 'x' on the night border. Plot the left horizontal asymptote value if it exists, after all points mentioned in paragraph 1 above, and plot the right horizontal asymptote value, if it exists, last. Depending on which horizontal asymptote(5) may or may not exist, the legend can have enties "Left Asymptote" and/or "Right Asymptote" (note that these are grammatically singular). Assuming the bonus in paragraph 5 is not implemented. 5) (a) If the input is a periodic function, plot 2 periods of the function including the point fo) 6) try to plot maxima, minima, inflection points, and vertical asymptotes in the 2 periods as described in paragraph 1 and () hopefully with a periodic maximum at the left and right borders of the plot. 6) If you believe that some "interesting points exist, but you cannot solve for them symbolically, just remove those interesting points from the collection that you are considering and then apply the rules to any remaining interesting points to determine the x limits of the figure. Create a MATLAB function that plots with fplot a mathematical function with limits for x determined according to the instructions below. The function should be implemented in the auto_fplot.in file provided Output = auto_fplot (func) Inputs: a mathematical function in x in symbolic form (fine) Output: a cell array as described below. This auto_fplot function should meet the following requirements. 1) After the mathematical function has been plotted, the auto_fplot function should be able to plot a set of interesting points (i.e. local maxima, local minima, inflection points, and two points for each vertical asymptote) for as many types of functions as possible. These should work for any polynomial equation. Vertical asymptotes should work for any rational function. All local maxima should be indicated with red circles, all local minima should be indicated with green circles and all inflection points should be indicated with blue circles. Vertical asymptotes should be indicated with black 'x's on the bottom and top borders (the fplot function of MATLAB draws dashed lines for the vertical asymptotes automatically). Each type of point must be drawn in that order if that type of point exists for the mathematical function. For each type, all points of that type must be plotted all at once and only if at least one point of that type exists. The "region of interest" or "domain of interest" (1.e. portion between the two extreme " interesting points if there is a finite number of such points) should be in the middle and occupy 70% of the x limits of the plot. If there is no interesting point found (or an infinite number of interesting points), plot the mathematical function and set the limits of x to be from -20 to 20 r. And if there is only one interesting point, interesting, then set the limits of x to be from (Xinteresting 20 ) to interesting + 20 ). Function auto_fplot retuns the following: Output = {fplotH; ImaxPlot, IminPlot; inflPlot; verAsymPlotBottom}; where fplotH returns the function line object retuned for the plot of f(x), and the other objects are the lineseries/line objects retuned for the plots of the local maxima, local minima, inflection points, and the bottom markers for vertical asymptotes. 2) The mathematical function as a title, axes labels (1.e., *x for x axis and 'f(x)' for y axis) and legend (.e., f(x)', 'Local Maxima', 'Local Minima', 'Inflection Points', and 'Vert. Asymptotes' as needed) should be included in the plot. Please make sure all your strings match these instructions. Only include in the legend those types of interesting points that exist for the mathematical function being plotted. These legend entries should be shown as plural even if there is only one point of a certain type. 3) Please complete the help comments at the top of the file. Do not modify the characters Boutput = AUTO_FPLOT (f" before the "..." Bonus requirements: 4) Can you include the location of any horizontal asymptotes? A left horizontal asymptote can be plotted as a green 'x' on the left border, and a night horizontal asymptote can be plotted as a red 'x' on the night border. Plot the left horizontal asymptote value if it exists, after all points mentioned in paragraph 1 above, and plot the right horizontal asymptote value, if it exists, last. Depending on which horizontal asymptote(5) may or may not exist, the legend can have enties "Left Asymptote" and/or "Right Asymptote" (note that these are grammatically singular). Assuming the bonus in paragraph 5 is not implemented. 5) (a) If the input is a periodic function, plot 2 periods of the function including the point fo) 6) try to plot maxima, minima, inflection points, and vertical asymptotes in the 2 periods as described in paragraph 1 and () hopefully with a periodic maximum at the left and right borders of the plot. 6) If you believe that some "interesting points exist, but you cannot solve for them symbolically, just remove those interesting points from the collection that you are considering and then apply the rules to any remaining interesting points to determine the x limits of the figure
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started