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
Strings as matrix: The matrix can be generated, that consists of strings in each row. Therefore, essentially it is created as a column vector of strings, but the final result

Animation: In this part we will observe a couple of ways to animate a plot. These are visuals, therefore the outcomes can't really be shown here; it is essential to type these

Example of Recursive functions: This definition is recursive as a factorial is defined in terms of the other factorial. There are two parts to any recursive definition: the co

Labels and Prompts: The script loads all the numbers from file into a row vector. It then splits the vector; it stores the initial element that is the experiment number in a v

5 p2+8p+15, 3 p2-3p-18, 12 p2-p-30

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

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

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, >>

strvcat function - concatenation: The function strvcat will concatenate it vertically, that means that it will generate a column vector of the strings.   >> strvcat(fir

Three-dimensional pie and bar: For the bar3 function, x & y vectors are passed and the function displays three-dimensional bars as shown in figure: Figure: Three-dimen