Built-in function for differentiation, MATLAB in Mathematics

Built-in function for Differentiation:

The MATLAB has a built-in function, diff that returns the differences between consecutive elements in a vector. For illustration,

>> diff([4 7 15 32])

ans =

3 8 17

For a function y = f(x) here x is a vector, and the values of f  '(x) can be approximated as diff(y) divided by diff(x). For illustration, the earlier equation can be written as an anonymous function.

>> f = @ (x) x .^ 3 + 2 .* x .^ 2 - 4 .* x + 3;

>> x = 1:3;

>> y = f(x)

y =

2 11 36

>> diff(y)

ans =

   9 25

>> diff(x)

ans =

   1 1

>> diff(y) ./ diff(x)

ans =

9 25

Posted Date: 10/22/2012 9:00:31 AM | Location : United States







Related Discussions:- Built-in function for differentiation, Assignment Help, Ask Question on Built-in function for differentiation, Get Answer, Expert's Help, Built-in function for differentiation Discussions

Write discussion on Built-in function for differentiation
Your posts are moderated
Related Questions
Error-checking for integers: illustrations of running this script as shown below: >> readoneint Enter an integer: 9.5 Invalid! Enter an integer: 3.6 Invalid

Illustration of Empty vectors: The Empty vectors can also be used to delete elements from the arrays. For illustration, to remove the third element from array, an empty vector

Illustrations of Variable number of output arguments: In the illustrations shown here, the user should actually know the type of the argument in order to establish how many va

Customizing Plots : There are numerous ways to customize figures in the Figure Window. On clicking the Plot Tools icon will bring up the Property Editor & Plot Browser, with ma

Illustration of Standard Deviation The less spread out the numbers are, therefore smaller the standard deviation will be, as it is a way of determining the spread of the data.

Standard Deviation The standard deviation is the square root of variance: The built-in function in a MATLAB for the standard deviation is known as std; the standard dev

Built in recursive function in MATLAB: We have seen that the built-in function in MATLAB to compute factorials, termed as the factorial and we know how to implement the iterat

Illustration of logical built-in functions: The function find returns the indices of a vector which meet certain criteria. For illustration, to find all the elements in a vect

bar and barh functions: For a matrix, the bar and barh functions will group altogether the values in each and every row. The illustration is as shown: rm = randint(2,4,[1

Use of string variables: The Characters involve letters of the alphabet, punctuation marks, digits, white space, and control characters. The Control characters are characters