No BSD License  

Highlights from
DIRDIFF

2.0

2.0 | 2 ratings Rate this file 3 Downloads (last 30 days) File Size: 770 Bytes File ID: #5832

DIRDIFF

by Mukhtar Ullah

 

03 Sep 2004 (Updated 11 Feb 2005)

Directional derivative

| Watch this File

File Information
Description

Xpf = dirdiff(X,f,p)

generates directional derivative of symbolic scalar function f at the point p in the direction of symbolic vector X(p). p must be a cell array {p1,p2,..pn} of doubles or symbolic variables.

examples
syms x1 x2 x3 y1 y2 y3
X = [ 2*x3 - x1^2 ; x1^3 - x3^2 ; x2^4 ] ;
f = x1^2 + x2^2 + x3^2 ;
dirdiff(X,f,{2,0,3}) returns Xpf = 3.5777
dirdiff(X,f,{y1,0,0}) returns Xpf = -2*y1^3/(y1^4+y1^6)^(1/2)

Required Products Symbolic Math Toolbox
MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
28 Nov 2007 Centi Riccardo

Function directionally derivative can be calcolated faster in the following way

syms a;
syms f1;
f1 = subs(f,x + a*X);
Xpdf = subs(diff ((f1-f),a),a,0)

28 Nov 2007 Riccardo Centi

% if F is a surface its directional
% derivative at the point x in the
% direction r can be expressed
% DF(x,r) = D(F(x+a*r,r) - F(x))/da with a = 0

syms a;
syms f1;
f1 = subs(f,x,x + a*r);
Xpdf = subs(diff ((f1-f),a),a,0)

Please login to add a comment or rating.
Updates
10 Sep 2004

fixed a bug. now X can also be a row vector.

11 Feb 2005

changed case for good documentation

Tag Activity for this File
Tag Applied By Date/Time
symbolic math Mukhtar Ullah 22 Oct 2008 07:31:08
directional derivative Mukhtar Ullah 22 Oct 2008 07:31:08
symbolic Mukhtar Ullah 22 Oct 2008 07:31:08
vector Mukhtar Ullah 22 Oct 2008 07:31:08
mathematics Mukhtar Ullah 22 Oct 2008 07:31:08

Contact us at files@mathworks.com