In this assignment, we use MATLAB to investigate how secant lines over shorter i
ID: 3286241 • Letter: I
Question
In this assignment, we use MATLAB to investigate how secant lines over shorter intervals approach the tangent line to a curve. The sample code given below considers the function y=x^3 and investigates the slope of the curve at (1,y(1)). The first figure considers secant lines connecting (1,y(1)) to points to the right -- (3,y(3)), (2,y(2)) and (1.5,y(1.5)) respectively The second figure considers secant lines connecting points (1-h,y(1-h)) to (1+h,y(1+h)) where h=2,1 and 0.5 respectively. The tangent line through (1,y(1)) is also shown. There are lots of comments in the code so you should try to read through it step by step. Run the given code and comment on whether one method or the other (i.e. using the point (1,y(1)) and points to the right is the first method and using points with (1,y(1)) in the middle is the second method) or both give slopes approaching the true slope of the tangent line. Is one method better than the other for this function? By better, I mean, as h gets closer to zero, which method gives slopes that are closer to the true instantaneous slope at x=1. Revise the code to consider similarly secant and tangent lines for the function y = 16/x at (4,y(4)). Plot over the interval 2Explanation / Answer
FOLLOW THIS FIRST CODE: %The following program shows how to plot curves, and secant and tangent %lines. %In this file, in figure 1 we plot the curve y=x^3 and the secant lines: % through (1,y(1)) and (3,y(3)) % through (1,y(1)) and (2,y(2)) % through (1,y(1)) and (1.5,y(1.5)) and % the tangent line through (1,y(1)) % For figure 2 we consider secant lines connecting: % through (-1,y(-1)) and (3,y(3)) % through (0,y(0)) and (2,y(2)) % through (0.5,y(0.5)) and (1.5,y(1.5)) and % the tangent line through (1,y(1)) %Helpful tip - The best way to learn MATLAB is to use the help menu. Hit