Preallocated array A using a for loop
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
timetry2
am 15 Sep. 2019
Kommentiert: madhan ravi
am 15 Sep. 2019
Consider an iterative series 1, (-1)/2, 1/3, (-1)/4, 1/5,…(-1)^(k-1)/k. The first 5 terms for k=1:5 are written here. Create the first 100 and store them all in a preallocated array A using a for loop.
Please help with this question. Thanks in advance!
0 Kommentare
Akzeptierte Antwort
madhan ravi
am 15 Sep. 2019
https://in.mathworks.com/help/matlab/matlab_prog/preallocating-arrays.html - you will see how to store values in each iteration through preallocation.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!