Hello, when I try and calculate the gradient I receive slope = gradient (fx)
slope =
(7167*x^2)/25000 - (3523*x)/5000 + 6389/10000
>> GRAD = vpa (slope, 10)
GRAD =
0.28668*x^2 - 0.7046*x + 0.6389
Will someone advised me how to interpret this please? GS.

 採用された回答

Star Strider
Star Strider 2018 年 1 月 31 日

1 投票

The vpa function converts the fractions to their decimal equivalents (decimal fractions).

7 件のコメント

Gavin Seddon
Gavin Seddon 2018 年 2 月 1 日
Thank you, to get a single answer must this be calculated?
Star Strider
Star Strider 2018 年 2 月 1 日
My pleasure.
Note that ‘GRAD’ is a function of ‘x’, so if you want a strictly numeric answer, you must provide a value for ‘x’.
Gavin Seddon
Gavin Seddon 2018 年 2 月 3 日
Hello, I followed the intuitive procedure however I received: x=10
x =
10
>> solve slope Warning: Do not specify equations and variables as character vectors. Instead, create symbolic variables with syms. > In solve>getEqns (line 445) In solve (line 225)
ans =
0 thank you, will you direct me further please? GS.
Star Strider
Star Strider 2018 年 2 月 3 日
My pleasure.
Your ‘slope’ expression needs to be defined as a function (available in R2012a and later).
syms x
slope(x) = (7167*x^2)/25000 - (3523*x)/5000 + 6389/10000;
x = 10;
GRAD = vpa(slope(10))
GRAD =
22.2609
Ideally, the expression that created ‘slope’ should be defined as a function. Then ‘slope’ will inherit the function designation, and be a function itself.
Gavin Seddon
Gavin Seddon 2018 年 2 月 3 日
Hello and thank you.
Gavin Seddon
Gavin Seddon 2018 年 2 月 3 日
Hello and thank you.
Star Strider
Star Strider 2018 年 2 月 3 日
As always, my pleasure.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by