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

A programming project to calculate the derivative of a continuous function at a given point using the difference quotient method. The project involves writing a matlab function, myowndydx, that takes the function, the point at which the derivative is desired, and the step size as inputs and returns the estimated value of the derivative. The document also includes instructions for testing the function and using comments and disp statements for debugging.

Typology: Assignments

Pre 2010

Uploaded on 09/17/2009

koofers-user-39z
koofers-user-39z 🇺🇸

7 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

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