MATLAB Answers

How to have a implicit function of a symbolic variable in our expressions and calculations

3 ビュー (過去 30 日間)
EllaD
EllaD 2021 年 1 月 25 日
コメント済み: EllaD 2021 年 1 月 25 日
Hello,
Lets say I have
syms x y z
and I want to have the following expression
A=(3*x+5*y+3*z+5)*(f(x)+z)
and I am looking to find
diff(A,x)
where f(x) is a function of x and I want to find the derivate of A with respect to x. Is there a way to write f(x) so that when differentiating A ,it shows it as ?
Appreciate any help.
Thanks a lot!

採用された回答

Birdman
Birdman 2021 年 1 月 25 日
Simply, you can define symbolic functions just like symbolic variables:
syms x y z f(x)
A=(3*x+5*y+3*z+5)*(f(x)+z);
diff(A,x)
ans =
3*z + 3*f(x) + diff(f(x), x)*(3*x + 5*y + 3*z + 5)

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by