Derivative of a function with constants

15 次查看(过去 30 天)
Hello,
how can i calculate the derivative of a function like x*e^x(a*x^2+b*x+c), where a,b,c are constants(for example integers).
I tried syms x a b c and then
f=inline('ax^2+bx+c','x')
diff(f(x),x)
but then i get an error.
A function like that is easy enough without Matlab but i want the sum of y'''+y''-y'+y which needs a lot of calculation.
Thanks in advance.
  1 个评论
jessupj
jessupj 2022-1-13
编辑:jessupj 2022-1-13
maybe
a*x^2 + b*x +c
with multiplication operations? (always report details of the error... its easier to tell what the problem is that way)

请先登录,再进行评论。

回答(1 个)

Torsten
Torsten 2022-1-13
syms x a b c
f = x*e^x*(a*x^2+b*x+c);
df = diff(f,x)
  4 个评论
Georgios Markoulis
Georgios Markoulis 2022-1-13
Thank you so much, do you know how to calculate also y'' and y'''
Torsten
Torsten 2022-1-14
编辑:Torsten 2022-1-14
d2f = diff(f,x,2)
d3f = diff(f,x,3)
...
dnf = diff(f,x,n) % n-th derivative, n has to be set to a value before

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by