Array indices must be positive integers or logical values.

Why do I get this error?
>> x=linspace(0,10,1000)';
>> y1(x)=cos(x).^2.*exp(-0.4.*x)
Array indices must be positive integers or logical values.

 Respuesta aceptada

KSSV
KSSV el 8 de Mayo de 2020
x = linspace(0,10,1000)';
y1 =cos(x).^2.*exp(-0.4.*x) ;
It is array operation...you don't need to index.

2 comentarios

thank you it works now
KSSV
KSSV el 8 de Mayo de 2020
In MATLAB indices should be positive integers. Indices cannot be zero, negative integers and fractions.
Thanks is accepting the answer.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Productos

Preguntada:

el 8 de Mayo de 2020

Comentada:

el 8 de Mayo de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by