フィルターのクリア

How to substitute to a variable in a function with a constant

2 ビュー (過去 30 日間)
ijsonvjksrefdsb
ijsonvjksrefdsb 2022 年 9 月 6 日
編集済み: Stephen23 2022 年 10 月 18 日
I'm trying to substitute some values of t to this equation:
x = 3.0 + 4.0.*t + c.*t.^2 - 2.0.*t.^3;
Unrecognized function or variable 't'.
But it won't work because of the c. The assignment is to avoid using symbolic math, how can I bypass this error? Like it would simply substitute the values of t with c remaining undefined. Thanks
  1 件のコメント
Stephen23
Stephen23 2022 年 10 月 18 日
編集済み: Stephen23 2022 年 10 月 18 日
Original question retrieved from Google Cache:
How to substitute to a variable in a function with a constant
I'm trying to substitute some values of t to this equation:
x = 3.0 + 4.0.*t + c.*t.^2 - 2.0.*t.^3;
Unrecognized function or variable 't'.
But it won't work because of the c. The assignment is to avoid using symbolic math, how can I bypass this error? Like it would simply substitute the values of t with c remaining undefined. Thanks

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

回答 (1 件)

Chunru
Chunru 2022 年 9 月 6 日
編集済み: Chunru 2022 年 9 月 6 日
% Specify the values beforehand
t = 0:.1:5;
c = 2;
x = 3.0 + 4.0.*t + c.*t.^2 - 2.0.*t.^3;
plot(t, x)
% symbolic computation
syms t c x
x = 3.0 + 4.0.*t + c.*t.^2 - 2.0.*t.^3
x = 
  2 件のコメント
ijsonvjksrefdsb
ijsonvjksrefdsb 2022 年 9 月 6 日
c can't be defined...
Chunru
Chunru 2022 年 9 月 6 日
Do you want to have symbolic computation?

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

カテゴリ

Help Center および 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