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
Illustration of a recursive function: illustration is of a recursive function which does not return anything, but simply prints. The below function prtwords receives a sentenc

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

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.

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

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

Write a MATLAB function [d1, u1, l1, c1, r1] = NaiveGaussArrow(d, u, l, c, r) that takes as input the 5 vectors de ned above representing A. This function performs Naive Gauss redu

Illustration of Advanced file input and output: For illustration, to refer to the third number in the first element of the cell array: >> subjdata{1}(3) ans =

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

Symbolic Expression The solve function solves an equation and returns the solution(s) as symbolic expressions. The answer can be converted to numbers by using any numeric funct

Strings as Vectors: The Strings are considered as vectors of characters-or in another words, a vector in which each and every element is a single character-so numerous vector