function [S]=matS(tp,M,N,C,D) S=zeros(tp,tp); S(1,:)=D; for i=1:tp, for j=1:i, if (i==j) S(i,j)=D; else S(i,j)=C*M^(i-2-j+1)*N; end; end; end;