MATLAB: Not enough input arguments.

b)function [u] = suitem(an] = size(a) u=u1 for i = 1 : nb u= a*u +b end endnb) [nu1

function [u] = suitem(A,b,u1,nb)
[n,n] = size(A) ;
u=u1 for i = 1 : nb
u= A*u +b
end
end

Best Answer

Other than having to fix the for being on the same line, it looks okay to me.
suitem(rand(8,8), rand, rand, 7)
ans = 8×8
5.9738 5.7873 6.4540 5.8167 5.9296 5.6976 6.9287 6.5290 6.3011 6.1045 6.8077 6.1355 6.2547 6.0097 7.3086 6.8868 6.9830 6.7651 7.5445 6.7995 6.9317 6.6601 8.0996 7.6322 6.8662 6.6519 7.4183 6.6857 6.8157 6.5487 7.9641 7.5045 7.3179 7.0894 7.9063 7.1255 7.2641 6.9795 8.4879 7.9982 7.8525 7.6073 8.4838 7.6460 7.7947 7.4894 9.1080 8.5824 5.8720 5.6887 6.3441 5.7176 5.8287 5.6005 6.8108 6.4178 5.0072 4.8508 5.4098 4.8755 4.9704 4.7757 5.8077 5.4726
function [u] = suitem(A,b,u1,nb)
[n,n] = size(A);
u=u1;
for i = 1 : nb
u= A*u +b;
end
end