www.gusucode.com > Matlab动力系统和时间序列分析工具箱 > Matlab动力系统和时间序列分析工具箱/lab432/toolbox/SSA/ssa_view_principal_components.m
function ssa_view_principal_components(SSA,comp_No); % SSA_VIEW_PRINCIPAL_COMPONENTS(SSA,comp_No) plot principal components of SSA % example: ssa_view_principal_components(SSA,[1 3 4 5 7 9]); % % last modified 10.02.05 str={}; for i=1:length(SSA.singular_numbers) str{i}=num2str(i); end if nargin<2 [selection,ok] = listdlg('PromptString','Select principal vectors:',... 'SelectionMode','multiple','ListString',str); else ok=1; selection=comp_No; end if ok N=length(selection); Fignumbs=floor(N/3); Additaxes=mod(N,3); tempHandleA=[]; tempHandleF=[]; for i=1:Fignumbs tempHandleF(i)=figure('Units','characters',... 'Name',['Principal components: ' num2str(selection(3*(i-1)+1)) ',' num2str(selection(3*(i-1)+2)) ',' num2str(selection(3*(i-1)+3))],... 'NumberTitle','off','color',[1 1 1]); for j=1:3 tempHandleA=[tempHandleA subplot(3,1,j)]; plot(SSA.singular_numbers(selection(3*(i-1)+j))*SSA.V(:,selection(3*(i-1)+j))), grid on ylabel(num2str(selection(3*(i-1)+j))); end end if Additaxes==1 tempHandleF(end+1)=figure('Units','characters',... 'Name',['Principal components: ' num2str(selection(3*Fignumbs+1))],... 'NumberTitle','off','color',[1 1 1]); end if Additaxes==2 tempHandleF(end+1)=figure('Units','characters',... 'Name',['Principal components: ' num2str(selection(3*Fignumbs+1)) ',' num2str(selection(3*Fignumbs+2))],... 'NumberTitle','off','color',[1 1 1]); end for i=1:Additaxes tempHandleA=[tempHandleA subplot(3,1,i)]; plot(SSA.singular_numbers(selection(3*Fignumbs+i))*SSA.V(:,selection(3*Fignumbs+i))), grid on ylabel(num2str(selection(3*Fignumbs+i))); end set(tempHandleA,'fontsize',8,'xlim',[1 length(SSA.V(:,1))]); end