x(t)=0.8cos(14t) this is my equation and i'm unable to plot this equation. It show me a error "Array indices must be positive integers or logical values."

 採用された回答

Star Strider
Star Strider 2021 年 10 月 6 日

1 投票

That would work (with multiplication operators) in the Symbolic Math Toolbox —
syms t
x(t)=0.8*cos(14*t)
x(t) = 
figure
fplot(x, [-2*pi 2*pi])
grid
It would need to be coded as an anonymous function to use it numerically —
x = @(t) 0.8*cos(14*t);
t = linspace(-2*pi, 2*pi, 500);
figure
plot(t, x(t))
grid
See the documentation section on Anonymous Functions for details.
.

2 件のコメント

raveen abeywardana
raveen abeywardana 2021 年 10 月 6 日
Ahh okay I got it. Thank you for your help.
Star Strider
Star Strider 2021 年 10 月 6 日
As always, my pleasure!
.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by