How to obtain the result of an operation in a vector
Show older comments
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 Comments
"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
on 7 Feb 2019
Answers (1)
madhan ravi
on 7 Feb 2019
Edited: madhan ravi
on 9 Feb 2019
sum(exp(-100:100))
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!