How to obtain the result of an operation in a vector

3 vues (au cours des 30 derniers jours)
Dionisio Mendoza
Dionisio Mendoza le 7 Fév 2019
Modifié(e) : madhan ravi le 9 Fév 2019
What I must do is place the result of this summation inside a vector so that I do not get disordered but I can not find the way to do it. I have something like this
for i = -100:100
x = exp(i)
i
end
  2 commentaires
Stephen23
Stephen23 le 7 Fév 2019
Modifié(e) : Stephen23 le 7 Fév 2019
"What I must do is place the result of this summation inside a vector"
What summation? There is no sum or anything like a sum in your code.
In any case, you either need to store the output using indexing, or write vectorized code:
x = exp(-100:100)
Very basic MATLAB concepts, such as how to use loops and indexing to store values, are explained in the introductory tutorials:
Dionisio Mendoza
Dionisio Mendoza le 7 Fév 2019
youre rigth i was wrong of excersice, but in that example were i put the vectorized code? sorry im very rookie

Connectez-vous pour commenter.

Réponses (1)

madhan ravi
madhan ravi le 7 Fév 2019
Modifié(e) : madhan ravi le 9 Fév 2019
sum(exp(-100:100))

Catégories

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

Community Treasure Hunt

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

Start Hunting!

Translated by