Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a matlab code to solve the following problem Problem 1 In this problem we will calculate the first and second derivatives of a function

Write a matlab code to solve the following problem

image text in transcribed

Problem 1 In this problem we will calculate the first and second derivatives of a function and examine the effect of method and step size Turn in (parts b-d): a table of the results organized by methods and step size. value of the numerical derivative percent error from the true (analytical) derivative Comment on the effects of method and step size. (a) Write three different functions to calculate the derivative: using the backward difference, forward difference, and central difference formulae. These functions should be general enough that you can use them in future problems (Probs. 2-4 below) (b) Calculate and plot the derivative of - over the range [3, 4] for all three methods, along with the actual value of the derivative. Try at least two different step sizes. In your table, report the error for each method and each step size at x -3.5. [Watch out: the arrays for the derivatives are different lengths, so make sure you're reporting the derivatives at the right point in the array] (c) Using the derivatives you calculated in part (b), calculate and plot the second derivative using all three methods. (For the second derivative using backward difference, use the first derivative you calculated using backward difference, and so on for the others). Also make a table for the error of the second derivate of the value at x-3.5. (d) Another way to calculate the second derivative is to use the formula f"(x) (Ar) Calculate and plot the second derivative using the function above. Calculate the error and add this result to your table

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

50 Tips And Tricks For MongoDB Developers Get The Most Out Of Your Database

Authors: Kristina Chodorow

1st Edition

1449304613, 978-1449304614

More Books

Students also viewed these Databases questions