www.gusucode.com > Matlab动力系统和时间序列分析工具箱 > Matlab动力系统和时间序列分析工具箱/lab432/toolbox/SSA/ssa_view_subcomp.m

    function ssa_view_subcomp(SSA,groups_No);
% SSA_VIEW_SUBCOMP(SSA,groups_No) plot groups by their numbers stored in groups_No
% using: ssa_view_subcomp(SSA,groups_No);
% example: ssa_view_subcomp(SSA,[1 3 5]);
%   this will plot 1st group, third group and fifth group
%
% last modified 10.02.05


grN=length(SSA.groups);
str={};
ylabel_str={};
curr_g=1;
for i=1:grN
    if ~isempty(SSA.groups{i})
        str{curr_g}=['group ' num2str(curr_g) ': '];
        ylabel_str{curr_g}=['group ' num2str(curr_g)];
        for j=1:length(SSA.groups{i})
            str{curr_g}=[str{curr_g} ' ' num2str(SSA.groups{i}(j))];
        end
        curr_g=curr_g+1;
    end
end

if nargin<2
	[selection,ok] = listdlg('PromptString','Select group:', 'SelectionMode','multiple','ListString',str);
else
    ok=1;
    selection=groups_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',['Group subcomponents. Group: ' 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_group_component(SSA,selection(3*(i-1)+j));
            ylabel(ylabel_str{selection(3*(i-1)+j)},'interpreter','none');
            drawnow
        end
    end
    if Additaxes==1
        tempHandleF(end+1)=figure('Units','characters',...
            'Name',['Group subcomponents. Group: ' num2str(selection(3*Fignumbs+1))],...
            'NumberTitle','off','color',[1 1 1]);
    end
    if Additaxes==2
        tempHandleF(end+1)=figure('Units','characters',...
            'Name',['Group subcomponents. Group: ' 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_group_component(SSA,selection(3*Fignumbs+i));
        ylabel(ylabel_str{selection(3*Fignumbs+i)},'interpreter','none');
        drawnow
    end
    set(tempHandleA,'fontsize',8);
end

function plot_group_component(SSA,grNo);

plot(1:length(SSA.base_data),ssa_get_group_component(SSA,grNo)),grid on
xlim([1 length(SSA.base_data)]);