Docsity

Calculating the Derivative of a Function using Difference Quotient, Assignments of Mechanical Engineering

Toggle sidebar
bg1
SAMPLE PROGRAMMING PROJECT
Title: Find the derivative of a continuous function.
Background
To calculate the derivative of a function, f(x) at a point, x, we can use the approximation
dx
xfdxxf
xf )()(
)(
Specifications
Input values to the function are
function, f
point at which
)( xf
is desired, x
step size, dx
Return the following in the function
estimated value of the derivative of the function
Conduct three separate appropriate tests in a separate mfile to see if all parts of the function are
working.
Use comments appropriately in the function mfile.
Use comments, disp, and frprintf statements appropriately in the test mfile.
Function skeleton
function fp=myowndydx(f, xi, dx)
…….
…….
fp=
end

Partial preview of the text

Download Calculating the Derivative of a Function using Difference Quotient and more Assignments Mechanical Engineering in PDF only on Docsity!

SAMPLE PROGRAMMING PROJECT

Title : Find the derivative of a continuous function. Background To calculate the derivative of a function, f(x) at a point, x, we can use the approximation dx f x dx f x f x

Specifications Input values to the function are  function, f

 point at which f^ (^ x )is desired, x

 step size, dx Return the following in the function  estimated value of the derivative of the function Conduct three separate appropriate tests in a separate mfile to see if all parts of the function are working. Use comments appropriately in the function mfile. Use comments, disp, and frprintf statements appropriately in the test mfile. Function skeleton function fp=myowndydx(f, xi, dx) ……. ……. fp= end