Hey everybody. I'm trying to create an n x n matrix where the first two elements are input as well as n. It needs to fill the matrix row by row with each successive summation. I used a loop, but I'm welcome to other suggestions. Here's my code.
n=input('n=\n');E1=input('First element=\n');E2=input('Second element=\n');fib=zeros(n,n);fib(1)=E1;fib(2)=E2;k=3;for k=3:size(fib); fib(n/n,k)=fib(k-1)+fib(k-2);endfib
Best Answer