How to assign a value of differential equation?
조회 수: 1 (최근 30일)
이전 댓글 표시
Not sure how to ask my question, but for example if I have
a= sin(5)+3x
I want to assign its differential value to b, how can I write this?
I can do: diff a
now how to make the answer equal to b b =
댓글 수: 0
답변 (1개)
David Sanchez
2013년 7월 29일
Derivatives: Using MATLAB
Using symbolic computation you can obtain analytical derivatives in MATLAB The function is diff(..)
% analytical derivatives
syms x y
y= sin(x); dy = diff(y,'x')
y=exp(2*x); dy = diff(y)
% derivative with respect to x is understood
f = sin(x); g = 2*x^2+3*x + 1;
y = f*g
dy =diff(y) % derivative of product
u= 2*x + 3; f = sin(u);
diff(f) % chain rule
Output from MATLAB
dy =
cos(x)
dy =
2*exp(2*x)
y =
sin(x)*(2*x^2+3*x+1)
dy =
cos(x)*(2*x^2+3*x+1)+sin(x)*(4*x+3)
ans =
2*cos(2*x+3)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!