Derivative of symbolic funtion at a specific value

1 Ansicht (letzte 30 Tage)
Ahmed Elkady
Ahmed Elkady am 22 Sep. 2012
I have a symbolic function of variable "x"
Function = @(x) 8-4.5*(x-sin (x));
say I need to get the derivative at x=5
what should i do?

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 22 Sep. 2012
Bearbeitet: Azzi Abdelmalek am 22 Sep. 2012
Function = @(x) 8-4.5*(x-sin (x));
Function(5)
%derivative
Function_d = @(x) diff('8-4.5*(x-sin (x))');
x=5; eval(Function_d(1))
  4 Kommentare
Ahmed Elkady
Ahmed Elkady am 22 Sep. 2012
Still not working, it gives the derivative as function of "x" but it doesn't evaluate at x=5
>> Function_d = @(x) diff('8-4.5*(x-sin (x))'); >> Function_d(5)
4.5*cos(x) - 4.5
Azzi Abdelmalek
Azzi Abdelmalek am 22 Sep. 2012
Bearbeitet: Azzi Abdelmalek am 22 Sep. 2012
try this
Function_d = @(x) diff('8-4.5*(x-sin (x))');
x=5; eval(Function_d(1))

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Ahmed Sheta
Ahmed Sheta am 25 Apr. 2017
syms x y=sin(x) a=diff(y,2,x) subs(a,x,pi/2)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by