function fitlinesine obs=[3,4,5,10,100]; % numbers of observations to use tmax=[1 1/2 1/4 1/8 1/16]; % maximum values of t to use for i=1:length(tmax) % for each tmax tm=tmax(i); % current tmax disp(sprintf('For the interval [0,%f]:',tm)); for j=1:length(obs) % for each number of observations m=obs(j); % current number of observations (will be number of rows) t=(0:m-1)'*tm/(m-1); % m linearly spaced t's from 0 to tmax A=[ones(m,1) t sin(2*pi*t)]; % construct matrix A c=cond(A); % indicates how ill conditioned system is disp(sprintf('%5d observations : cond=%f',m,c)); end disp(' '); end