Code not working?

10 vues (au cours des 30 derniers jours)
Catherine Mohs
Catherine Mohs le 31 Jan 2019
Commenté : Catherine Mohs le 31 Jan 2019
I keep getting an error when I run this code. What am I doing wrong?
t=[0:2:100];
height=2.13*t.^2-0.0013*t.^4+0.000034*t.^4.751;
max_height=max(height)
time_max_height=t(max_height)

Réponse acceptée

madhan ravi
madhan ravi le 31 Jan 2019
[max_height,idx]=max(height);
% ^^^---- gives the index , you were rying to index with value instead of true index
time_max_height=t(idx)
  1 commentaire
Catherine Mohs
Catherine Mohs le 31 Jan 2019
Thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Tags

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by