?? spanview.m
字號:
function spanview(s,numvec)% SPANVIEW is a utility for visualizing the% span of a set of vectors in 3-space. The% command spanview(x,n) will plot n random % multiples of the vector x. Each of these% vectors is represented by a dot.% The user is then prompted to input a second% vector and the computer plots n random% linear combinations of the two input vectors.% The program keeps asking for more vectors % until 3 linearly independent vectors have % been entered.%% This routine was written by Steven Leon% in August, 2002. It incorporates features% from earlier ATLAST programs for visualizing% the span of vectors.if size(s)==[3,1] s=reshape(s,1,3);end whitebg('w')A=[];x=[0,0]';y=x;z=x;r=0;n=0;colors='brgmc';closewhile r<3 n=n+1; if n>1 s=input('Add another vector to S. Enter it as a triple [x y z]: '); delete(t) hold off end A=[A s']; c=randn(n,numvec); v=A*c; axiscale=3*max(max(abs(A)))+1; x(:,n)=[0;A(1,n)]; y(:,n)=[0;A(2,n)]; z(:,n)=[0;A(3,n)]; r=fix(rank(A)); color=[colors(mod(n,5)+1),'.']; plot3(x(:,n),y(:,n),z(:,n),'k') hold on plot3([-axiscale axiscale],[0 0 ],[0 0],'k',[0 0],[-axiscale axiscale],[0 0],'k',[0 0],[0 0],[-axiscale axiscale],'k') plot3(v(1,:),v(2,:),v(3,:),color) t=title(['Span of S ' 'Dimension = ' sprintf('%4.0f',r)]);figure(1)endhold off
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -