フィルターのクリア

How can I plot two functions in the same graph?

1 回表示 (過去 30 日間)
Wenchen Liu
Wenchen Liu 2022 年 11 月 1 日
編集済み: Torsten 2022 年 11 月 1 日
I have a code like this:
fplot(@(x) cosh(x))
hold on
p(x) = 0.6671x^3-1.7921x^2+2.7580x-0.089
fplot(@(x) p(x))
hold off
since p(x) is a more complex function. And when I try to run the code, the command shows "Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters,
or other syntax error. To construct matrices, use brackets instead of parentheses."
I don't know how to fix for this. Please me, thank you!

採用された回答

Torsten
Torsten 2022 年 11 月 1 日
編集済み: Torsten 2022 年 11 月 1 日
fplot(@cosh)
hold on
p = @(x)0.6671*x.^3-1.7921*x.^2+2.7580*x-0.089;
fplot(p)
hold off

その他の回答 (1 件)

Jim Riggs
Jim Riggs 2022 年 11 月 1 日
編集済み: Jim Riggs 2022 年 11 月 1 日
Try this:
fplot(@(x) cosh(x));
hold on
fplot(@(x) 0.6671x^3-1.7921x^2+2.7580x-0.089);

カテゴリ

Help Center および File ExchangeFunction Creation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by