Answer:
%first 3 Fibonacci numbers
f(1)=0;
f(2)=1;
f(3)=1;
%next 18 Fibonacci numbers
for i=1:22
f(i+3)=f(i)+f(i+1)+f(i+2);
end
%display the Fibonacci numbers
fprintf('First 25 Fiboncci numbers:\\')
fprintf('%d, ', f(1:24));
fprintf('%d\\', f(25));
Step-by-step explanation:
The MATLAB code above prints out the first 25 numbers in a fibonacci sequence. The sum of the previous three elements is equal to the next element.