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
Writing to Files: There are many lower level functions which can write to files. We will focus on the fprintf function that can be used to write a file and also to append to a

Nested IF-ELSE statements: The if-else statement is used to select between the two statements. In order to select from more than two statements, the if-else statements can als

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

Plot Functions: Faraway, we have plotted to generate two-dimensional plots and bar to generate bar charts. We have seen how to clear the Figure Window by using clf, and how to

Functions to create special matrices: The MATLAB also has various functions which create special matrices. For illustration, the zeros function generates a matrix of all zeros

Illustration of Logical vectors: Calling the function appears to return similar vector as simply vec > 5, and summing the result still works to determine how many elements wer

Changing Dimensions: In addition to transpose operator, the MATLAB has some built-in functions which change the dimensions or configuration of matrices, involving fliplr, resh

Dimensions - matrix: The size and length functions in the MATLAB are used to find array dimensions. Length function returns the number of elements in the vector. The size func

Strcat function - Concatenation : The strcat function, though, will eliminate the trailing blanks from strings before concatenating. Note that in these illustrations, the trail

Minimum and Maximum Value The MATLAB has built-in functions for numerous statistics. For illustration, min and max to find the minimum or maximum value in a data set. >> x