Donald, regarding your new "Answer", you can do it like this: N=[10 100 1000]; for n = 1 : length(N) first=1; second=1; for k = 3 : N(n) %The index has to have two terms removed because it starts with 1 and 1 already next = first+second; %The current term in the series is a summation of the previous two terms first = second; %Each term must by iterated upwards by an index of one second = next; %The term that previously was second is now referred to as next end % Print to command window next end Answer from Image Analyst on mathworks.com
Discussions

Adding values to a matrix in for loop
Adding values to a matrix in for loop . Learn more about forloop, arrays, addingarrays MATLAB More on se.mathworks.com
🌐 se.mathworks.com
2
0
December 5, 2021
How do I properly append to an array within a loop?
How do I properly append to an array within a... Learn more about array, loop, for loop, data, append, store MATLAB More on se.mathworks.com
🌐 se.mathworks.com
2
2
October 16, 2017
How can I create an array with a for loop?
Hi I’m trying to create an array of values that are output from a function. The function goes from -20 to 50 but I can’t create an array that large so I’m confused on what to do. The attached pictu... More on es.mathworks.com
🌐 es.mathworks.com
2
1
March 12, 2018
How to create an array using for loop?
How to create an array using for loop?. Learn more about for loop, array, if statement More on mathworks.com
🌐 mathworks.com
2
0
November 6, 2012
🌐
Mathworks
se.mathworks.com › matlabcentral › answers › 361580-how-do-i-properly-append-to-an-array-within-a-loop
How do I properly append to an array within a loop? - MATLAB Answers - MATLAB Central
October 16, 2017 - From this process I should end up with a separate 300,1 array of values for both 'ia_time' (which is just the original txt file data), and a 300,1 array of values for 'Ai', which has just been calculated. It's a complex, yet easy issue. Looking back over it now, I'm not sure how I ended up where I did. I'm going to scrap it all, and start from scratch. ... https://se.mathworks.com/matlabcentral/answers/361580-how-do-i-properly-append-to-an-array-within-a-loop#comment_493560
🌐
MathWorks
es.mathworks.com › matlabcentral › answers › 387771-how-can-i-create-an-array-with-a-for-loop
How can I create an array with a for loop? - MATLAB Answers - MATLAB Central
March 12, 2018 - At each step, the statement in for loop is executed and the result is stored in A array. Jos (10584) el 12 de Mzo. de 2018 ... https://es.mathworks.com/matlabcentral/answers/387771-how-can-i-create-an-array-with-a-for-loop#comment_544576
Find elsewhere
🌐
Mathworks
nl.mathworks.com › matlabcentral › answers › 2086378-iterating-array-over-for-loop
iterating array over for loop - MATLAB Answers - MATLAB Central
February 24, 2024 - Tempxy = [0:0.125:2;10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 30]; lengthX = length(Tempxy); for x = 2:lengthX-1 TempUpdated = (Tempxy(2,x+1)+Tempxy(2,x-1))./2; break end Hello, I am...
🌐
MathWorks
mathworks.com › matlabcentral › answers › 126197-for-loops-lengths-size-command
For loops & lengths/size command - MATLAB Answers - MATLAB Central
April 18, 2014 - This is equivalent to length for a vector or the product of all dimensions in a matrix. Using the above examples, numel(x) =5 and numel(Y) =12 (since there are four rows and three columns). Hope that this helps! ... Sign in to comment. ... Sign in to comment. Sign in to answer this question. Find more on Loops and Conditional Statements in Help Center and File Exchange ... Find the treasures in MATLAB Central and discover how the community can help you!
🌐
MathWorks
mathworks.com › matlabcentral › answers › 483871-for-loop-for-multiple-arrays
For loop for multiple arrays - MATLAB Answers - MATLAB Central
October 6, 2019 - x= a+b+c where a=[ 1 2 3 4], b=[5 6 7 8] and c =[9 10 11 12 ] How to use for loop for this.
🌐
MathWorks
ch.mathworks.com › matlabcentral › answers › 1811650-looping-through-object-array-possible-to-get-an-iterator-to-index-into-the-object-array
Looping through object array, possible to get an iterator to index into the object array? - MATLAB Answers - MATLAB Central
September 25, 2022 - While MATLAB allows you to iterate over any array type, in practice (as soon as you do anything more complex than just looking at each single element) it is almost always simpler and clearer to iterate over indices into that array. Sign in to comment. Sign in to answer this question. ... https://ch.mathworks.com/matlabcentral/answers/1811650-looping-through-object-array-possible-to-get-an-iterator-to-index-into-the-object-array#answer_1060430
🌐
MathWorks
mathworks.com › matlabcentral › answers › 628883-create-an-array-with-an-output-from-a-loop
create an array with an output from a loop - MATLAB Answers - MATLAB Central
October 28, 2020 - Is there a way to create an entirely new array with an output from a loop? For example: If a condition is met, increase or decrease N by 1 Repeat 1000 times Example result: N = 1,2,3,2,1,2,3,4,...
🌐
MathWorks
mathworks.com › matlabcentral › answers › 649443-for-each-loop-upon-fixed-size-array
For each loop upon fixed size array - MATLAB Answers - MATLAB Central
November 16, 2020 - %do something with m / do arithmatic with m , m is the value of array A and next value of array A updated to m at each iteration ... https://www.mathworks.com/matlabcentral/answers/649443-for-each-loop-upon-fixed-size-array#comment_1137768