フィルターのクリア

Printing out proper equation statement using fprintf.

4 ビュー (過去 30 日間)
Stephanie Mendoza
Stephanie Mendoza 2022 年 9 月 4 日
回答済み: Star Strider 2022 年 9 月 4 日
I need the following equation (fa(s)) to print out in this format. fa(s) =x.xxxx x^2 . Right now it is only printing out only this ... 6.0000. It doesn't want to print the x^2. Can someone help?
Code:
s=1;
fa(s) = 6*s.^2;
fprintf('%.4f',fa(s))

採用された回答

Star Strider
Star Strider 2022 年 9 月 4 日
If you want ‘fa’ to be a function (outside of the Symbolic Math Toolbox) it needs to be careated as an anonymous function:
fa = @(s) 6*s.^2;
Then —
s=1;
fa = @(s) 6*s.^2;
fprintf('fa(x) = %.4f x^2',fa(s)./s)
fa(x) = 6.0000 x^2
I am not certain what you want.
.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by