⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spanview.m

📁 matlab 在线性代数中的应用 利用matlab实现可以提高对所学知识的理解 更有助于你考研
💻 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 + -