Gradient function with multiple variables?

In my program I am asking for user input for a 3 dimensional vector X. My example equation is Y=X(1)^3+2*X(2)^2+4*X(3). Now I want to calculate the gradient of the equation. My initial thought was to do gradient(Y, [X]) but that creates an error. I've also tried gradient(Y, [X(1), X(2),X(3)]). Any help would be greatly appreciated.

回答 (1 件)

Torsten
Torsten 2017 年 4 月 3 日

0 投票

https://de.mathworks.com/help/symbolic/gradient.html
The first example should show you how to set up your code.
Best wishes
Torsten.

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

タグ

質問済み:

2017 年 4 月 2 日

回答済み:

2017 年 4 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by