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."

 Akzeptierte Antwort

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 Kommentare

Ahh okay I got it. Thank you for your help.
As always, my pleasure!
.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Community Treasure Hunt

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

Start Hunting!

Translated by