Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please complete in MATLAB asap. Thank you 1.2 For the polynomial f(x)=x42x3, calculate the derivative and the 2 nd derivative analytically (the first derivative so
please complete in MATLAB asap. Thank you
1.2 For the polynomial f(x)=x42x3, calculate the derivative and the 2 nd derivative analytically (the first derivative so that you can compare with your numerical derivatives to determine the error, and the second derivative might be useful for understanding your results -see equations (1.9) and (1.11)). a) Choose different step sizes h and plot a log-log graph of error vs step size to compare the numerical derivatives found using the forward, backward, and central difference formulas with the actual derivative. How accurate are the numerical derivatives at x=0,1,1.5, and 2 ? At what step sizes do you obtain the minimum errors, and what are the minimum errors (see Sauer figure 5.1)? Do you expect that this would be a problem? What if you were using single-precision floating point? (You can easily try this in Matlab by using the single() function.) b) Add some additional error to your polynomial. For example, try y= f(x)+0.001randn(size(x)); . How does the error in the numerical derivative vary with step size h ? Try changing the size of the error. Checklist Did you differentiate the function (including with added error)? Did you explain how you did it? Did you plot graphs showing the error vs step size at each point? Are your graphs and axes properly labelled? Did you discuss whether the results were what you expected? Did you discuss any unusual results? Did you include code where appropriate? Did you reference the source of any code you didn't writeStep 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