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.

 Réponse acceptée

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

2 commentaires

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by