          
% plot_nine.m  ver 1.1   by Tom Irvine

function[fig_num]=plot_nine(tt,a,aa,v,vv,vvv,d,ddd,fig_num,dy,vy,ay)

            a1=max(abs(a));
            a2=max(abs(a));
            amax=max([a1 a2 ]);
            
            [ya]=ytick_linear_altp(amax);
            
            v1=max(abs(v));
            v2=max(abs(vv));
            v3=max(abs(vvv));
            vmax=max([v1 v2 v3]);
            [yv]=ytick_linear_altp(vmax);
            
            d1=max(abs(d));
            d3=max(abs(ddd));
            dmax=max([d1  d3]);
            [yd]=ytick_linear_altp(dmax);
            
            dt=mean(diff(tt));
          
            tstart=tt(1);
            tend=tt(end)+dt;
            
            hp=figure(fig_num);
            fig_num=fig_num+1;
            subplot(3,3,1);
            plot(tt,a);
            ylabel(ay);
            xlim([tstart tend]);
            ylim([-ya(1) ya(1)]);
            grid on;
            
            subplot(3,3,2);
            plot(tt,aa);
            xlim([tstart tend]);
            ylim([-ya(1) ya(1)]);
            grid on;
            
            subplot(3,3,3);
            plot(tt,aa);
            xlim([tstart tend]);
            ylim([-ya(1) ya(1)]);
            grid on;
            
            subplot(3,3,4);
            plot(tt,v);
            ylabel(vy);
            xlim([tstart tend]);
            ylim([-yv(1) yv(1)]);
            grid on;
            
            subplot(3,3,5);
            plot(tt,vv);
            ylim([-yv(1) yv(1)]);
            xlim([tstart tend]);
            grid on;
            
            subplot(3,3,6);
            plot(tt,vvv);
            xlim([tstart tend]);
            ylim([-yv(1) yv(1)]);
            grid on;
            
            subplot(3,3,7);
            plot(tt,d);
            xlim([tstart tend]);
            ylabel(dy);
            ylim([-yd(1) yd(1)]);
            grid on;
            xlabel('Time(sec)');
            
            subplot(3,3,8);
            plot(tt,d);
            ylim([-yd(1) yd(1)]);
            xlim([tstart tend]);
            grid on;
            xlabel('Time(sec)');
            
            subplot(3,3,9);
            plot(tt,ddd);
            ylim([-yd(1) yd(1)]);
            xlim([tstart tend]);
            grid on;
            xlabel('Time(sec)');
            
            set(hp, 'Position', [0 0 850 650]);


