% Exploration whether MATLAB can numerically tell % the linear dependence of set of the functions % {1,cos(x),cos(2x),xos^2(x)}. % Using 31 datapoints, i.e work w/ a 4 x 31 matrix % (projection of function space into 31 dim space). % Some graphical displays.... % % Primarily for demo purposes to start a discussion. % % All rights reserved. Matthias Kawski. % http://math.la.asu.edu/~kawski % Original Fall 1996 (?). % Comments added August 2000. echo on xx=[0:0.1:3]; yy=ones(size(xx)); cc=cos(xx); c2c=cos(2*xx); csq=cc.*cc; plot(xx,cc,xx,c2c,xx,csq,xx,yy) axis([0 3.2 -1.1 1.1]) pause A(1,:)=yy; A(2,:)=cc; A(3,:)=csq; A(4,:)=c2c plot(A) axis([1.8 4.2 -1.1 1.1]) pause plot(A') axis([0 32 -1.1 1.1]) pause rank(A) pause rref(A) pause help rank pause rank(A,1) rank(A,10) rank(A,0.1) rank(A,0.01) rank(A,0.0001) pause rank(A,0.0000001) rank(A,0.00000000001) rank(A,0.00000000000001) rank(A,0.0000000000000001) echo off