Can someone tell how I should code this equation for plot

1 visualización (últimos 30 días)
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."

Respuesta aceptada

Star Strider
Star Strider el 6 de Oct. de 2021
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 comentarios
raveen abeywardana
raveen abeywardana el 6 de Oct. de 2021
Ahh okay I got it. Thank you for your help.
Star Strider
Star Strider el 6 de Oct. de 2021
As always, my pleasure!
.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by