clc

% TORNOZELO
    % BINARIO
        BinarioCargaMaximaMinimaMediaServoTornozelok(1,1) = ...
            max(BinTorDir.signals.values);
        BinarioCargaMaximaMinimaMediaServoTornozelok(1,2) = ...
            min(BinTorDir.signals.values);
        BinarioCargaMaximaMinimaMediaServoTornozelok(1,3) = ...
            sum(BinTorDir.signals.values) / size(BinTorDir.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoTornozelok(1,5) = ...
            max(BinTorDir1.signals.values);
        BinarioCargaMaximaMinimaMediaServoTornozelok(1,6) = ...
            min(BinTorDir1.signals.values);
        BinarioCargaMaximaMinimaMediaServoTornozelok(1,7) = ...
            sum(BinTorDir1.signals.values) / size(BinTorDir.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoTornozelok(1,9) = ...
            max(BinTorDir2.signals.values);
        BinarioCargaMaximaMinimaMediaServoTornozelok(1,10) = ...
            min(BinTorDir2.signals.values);
        BinarioCargaMaximaMinimaMediaServoTornozelok(1,11) = ...
            sum(BinTorDir2.signals.values) / size(BinTorDir2.signals.values,1);


    % CARGA
        BinarioCargaMaximaMinimaMediaServoTornozelok(2,1) = ...
            max(BinTorDir.signals.values / 12 * 100);
        BinarioCargaMaximaMinimaMediaServoTornozelok(2,2) = ...
            min(BinTorDir.signals.values / 12 * 100);
        BinarioCargaMaximaMinimaMediaServoTornozelok(2,3) = ...
            sum(BinTorDir.signals.values / 12 * 100) / size(BinTorDir.signals.values / 12 * 100,1);

        BinarioCargaMaximaMinimaMediaServoTornozelok(2,5) = ...
            max(BinTorDir1.signals.values / 12 * 100);
        BinarioCargaMaximaMinimaMediaServoTornozelok(2,6) = ...
            min(BinTorDir1.signals.values / 12 * 100);
        BinarioCargaMaximaMinimaMediaServoTornozelok(2,7) = ...
            sum(BinTorDir1.signals.values / 12 * 100) / size(BinTorDir1.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoTornozelok(2,9) = ...
            max(BinTorDir2.signals.values / 12 * 100);
        BinarioCargaMaximaMinimaMediaServoTornozelok(2,10) = ...
            min(BinTorDir2.signals.values / 12 * 100);
        BinarioCargaMaximaMinimaMediaServoTornozelok(2,11) = ...
            sum(BinTorDir2.signals.values / 12 * 100) / size(BinTorDir2.signals.values,1);


        BinarioCargaMaximaMinimaMediaServoTornozelok

    % GRAFICO
        figure(1);
        
        subplot(2,3,1);
        
        plot(Tempo.signals.values,BinTorDir.signals.values,'c');
        hold on;
        plot(Tempo.signals.values,BinTorDir1.signals.values,'b');
        plot(Tempo.signals.values,BinTorDir2.signals.values,'r');
        plot(Tempo.signals.values,AngTorDir.signals.values,'g');
        axis([0 Tempo.signals.values(size(Tempo.signals.values,1),1) -12 12]);
        grid on; hold off;
        title('Variacao Binario Tornozelo para k dif');
        
        subplot(2,3,4);
        plot(Tempo.signals.values,BinTorDir.signals.values / 12 * 100,'c');grid on;
        hold on;
        plot(Tempo.signals.values,BinTorDir1.signals.values / 12 * 100,'b');grid on;
        plot(Tempo.signals.values,BinTorDir2.signals.values / 12 * 100,'r');grid on;
        plot(Tempo.signals.values,AngTorDir.signals.values,'g');
        axis([0 Tempo.signals.values(size(Tempo.signals.values,1),1) -100 100]);
        grid on; hold off;
        title('Variacao Taxa Tornozelo para k dif');

% JOELHO
    % BINARIO
        BinarioCargaMaximaMinimaMediaServoJoelhok(1,1) = ...
            max(BinJoeDir.signals.values);
        BinarioCargaMaximaMinimaMediaServoJoelhok(1,2) = ...
            min(BinJoeDir.signals.values);
        BinarioCargaMaximaMinimaMediaServoJoelhok(1,3) = ...
            sum(BinJoeDir.signals.values) / size(BinJoeDir.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoJoelhok(1,5) = ...
            max(BinJoeDir1.signals.values);
        BinarioCargaMaximaMinimaMediaServoJoelhok(1,6) = ...
            min(BinJoeDir1.signals.values);
        BinarioCargaMaximaMinimaMediaServoJoelhok(1,7) = ...
            sum(BinJoeDir1.signals.values) / size(BinJoeDir1.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoJoelhok(1,9) = ...
            max(BinJoeDir2.signals.values);
        BinarioCargaMaximaMinimaMediaServoJoelhok(1,10) = ...
            min(BinJoeDir2.signals.values);
        BinarioCargaMaximaMinimaMediaServoJoelhok(1,11) = ...
            sum(BinJoeDir2.signals.values) / size(BinJoeDir2.signals.values,1);

        
    % CARGA
        BinarioCargaMaximaMinimaMediaServoJoelhok(2,1) = ...
            max(BinJoeDir1.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoJoelhok(2,2) = ...
            min(BinJoeDir1.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoJoelhok(2,3) = ...
            sum(BinJoeDir1.signals.values / 4 * 100) / size(BinJoeDir1.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoJoelhok(2,5) = ...
            max(BinJoeDir1.signals.values / 4 *100);
        BinarioCargaMaximaMinimaMediaServoJoelhok(2,6) = ...
            min(BinJoeDir1.signals.values / 4 *100);
        BinarioCargaMaximaMinimaMediaServoJoelhok(2,7) = ...
            sum(BinJoeDir1.signals.values / 4 *100) / size(BinJoeDir1.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoJoelhok(2,9) = ...
            max(BinJoeDir2.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoJoelhok(2,10) = ...
            min(BinJoeDir2.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoJoelhok(2,11) = ...
            sum(BinJoeDir2.signals.values) / size(BinJoeDir2.signals.values,1);

        
        BinarioCargaMaximaMinimaMediaServoJoelhok
        
    % GRAFICO
        subplot(2,3,2);
        plot(Tempo1.signals.values,BinJoeDir.signals.values,'c');grid on;
        hold on;
        plot(Tempo1.signals.values,BinJoeDir1.signals.values,'b');grid on;
        plot(Tempo1.signals.values,BinJoeDir2.signals.values,'r');grid on;
        plot(Tempo1.signals.values, AngJoeDir.signals.values/100,'g');
        axis([0 Tempo1.signals.values(size(Tempo1.signals.values,1),1) -4 4]);
        grid on;hold off;
        title('Variacao Binario Joelho para k dif');
        
        subplot(2,3,5);
        plot(Tempo1.signals.values, BinJoeDir.signals.values / 4 * 100,'c');grid on;
        hold on;
        plot(Tempo1.signals.values, BinJoeDir1.signals.values / 4 * 100,'b');grid on;
        plot(Tempo1.signals.values, BinJoeDir2.signals.values / 4 * 100,'r');grid on;
        plot(Tempo1.signals.values, AngJoeDir.signals.values,'g');
        axis([0 Tempo1.signals.values(size(Tempo1.signals.values,1),1) -100 100]);
        grid on;hold off;
        title('Variacao Taxa Joelho para k dif');

%ANCA
    % BINARIO
        BinarioCargaMaximaMinimaMediaServoAncak(1,1) = ...
            max(BinAncDir.signals.values);
        BinarioCargaMaximaMinimaMediaServoAncak(1,2) = ...
            min(BinAncDir.signals.values);
        BinarioCargaMaximaMinimaMediaServoAncak(1,3) = ...
            sum(BinAncDir.signals.values) / size(BinAncDir.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoAncak(1,5) = ...
            max(BinAncDir1.signals.values);
        BinarioCargaMaximaMinimaMediaServoAncak(1,6) = ...
            min(BinAncDir1.signals.values);
        BinarioCargaMaximaMinimaMediaServoAncak(1,7) = ...
            sum(BinAncDir1.signals.values) / size(BinAncDir1.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoAncak(1,9) = ...
            max(BinAncDir2.signals.values);
        BinarioCargaMaximaMinimaMediaServoAncak(1,10) = ...
            min(BinAncDir2.signals.values);
        BinarioCargaMaximaMinimaMediaServoAncak(1,11) = ...
            sum(BinAncDir2.signals.values) / size(BinAncDir2.signals.values,1);
       
    % CARGA
        BinarioCargaMaximaMinimaMediaServoAncak(2,1) = ...
            max(BinAncDir.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoAncak(2,2) = ...
            min(BinAncDir.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoAncak(2,3) = ...
            sum(BinAncDir.signals.values / 4 * 100) / size(BinAncDir.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoAncak(2,5) = ...
            max(BinAncDir1.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoAncak(2,6) = ...
            min(BinAncDir1.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoAncak(2,7) = ...
            sum(BinAncDir1.signals.values / 4 * 100) / size(BinAncDir1.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoAncak(2,9) = ...
            max(BinAncDir2.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoAncak(2,10) = ...
            min(BinAncDir2.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoAncak(2,11) = ...
            sum(BinAncDir2.signals.values / 4 * 100) / size(BinAncDir2.signals.values,1);

        
        BinarioCargaMaximaMinimaMediaServoAncak
        
    % GRAFICO
        subplot(2,3,3);
        plot(Tempo2.signals.values, BinAncDir.signals.values,'c');grid on;
        hold on;
        plot(Tempo2.signals.values, BinAncDir1.signals.values,'b');grid on;
        plot(Tempo2.signals.values, BinAncDir2.signals.values,'r');grid on;
        plot(Tempo2.signals.values, AngAncDir.signals.values/100,'g');
        axis([0 Tempo2.signals.values(size(Tempo2.signals.values,1),1) -4 4]);
        grid on;hold off;
        title('Variacao Binario Anca para k dif');
        
        subplot(2,3,6);
        plot(Tempo2.signals.values, BinAncDir.signals.values / 4 * 100,'c');grid on;
        hold on;
        plot(Tempo2.signals.values, BinAncDir1.signals.values / 4 * 100,'b');grid on;
        plot(Tempo2.signals.values, BinAncDir2.signals.values / 4 * 100,'r');grid on;
        plot(Tempo2.signals.values, AngAncDir.signals.values,'g')
        axis([0 Tempo2.signals.values(size(Tempo2.signals.values,1),1) -100 100]);
        grid on;hold off;
        title('Variacao Taxa Anca para k dif');
        

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% TORNOZELO
    % BINARIO
        BinarioCargaMaximaMinimaMediaServoTornozeloF(1,1) = ...
            max(BinTorDir3.signals.values);
        BinarioCargaMaximaMinimaMediaServoTornozeloF(1,2) = ...
            min(BinTorDir3.signals.values);
        BinarioCargaMaximaMinimaMediaServoTornozeloF(1,3) = ...
            sum(BinTorDir3.signals.values) / size(BinTorDir3.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoTornozeloF(1,5) = ...
            max(BinTorDir4.signals.values);
        BinarioCargaMaximaMinimaMediaServoTornozeloF(1,6) = ...
            min(BinTorDir4.signals.values);
        BinarioCargaMaximaMinimaMediaServoTornozeloF(1,7) = ...
            sum(BinTorDir4.signals.values) / size(BinTorDir4.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoTornozeloF(1,9) = ...
            max(BinTorDir5.signals.values);
        BinarioCargaMaximaMinimaMediaServoTornozeloF(1,10) = ...
            min(BinTorDir5.signals.values);
        BinarioCargaMaximaMinimaMediaServoTornozeloF(1,11) = ...
            sum(BinTorDir5.signals.values) / size(BinTorDir5.signals.values,1);

            
    % CARGA
        BinarioCargaMaximaMinimaMediaServoTornozeloF(2,1) = ...
            max(BinTorDir3.signals.values / 12 * 100);
        BinarioCargaMaximaMinimaMediaServoTornozeloF(2,2) = ...
            min(BinTorDir3.signals.values / 12 * 100);
        BinarioCargaMaximaMinimaMediaServoTornozeloF(2,3) = ...
            sum(BinTorDir3.signals.values / 12 * 100) / size(BinTorDir3.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoTornozeloF(2,5) = ...
            max(BinTorDir4.signals.values / 12 * 100);
        BinarioCargaMaximaMinimaMediaServoTornozeloF(2,6) = ...
            min(BinTorDir4.signals.values / 12 * 100);
        BinarioCargaMaximaMinimaMediaServoTornozeloF(2,7) = ...
            sum(BinTorDir4.signals.values / 12 * 100) / size(BinTorDir4.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoTornozeloF(2,9) = ...
            max(BinTorDir5.signals.values / 12 * 100);
        BinarioCargaMaximaMinimaMediaServoTornozeloF(2,10) = ...
            min(BinTorDir5.signals.values / 12 * 100);
        BinarioCargaMaximaMinimaMediaServoTornozeloF(2,11) = ...
            sum(BinTorDir5.signals.values / 12 * 100) / size(BinTorDir5.signals.values,1);

        
        BinarioCargaMaximaMinimaMediaServoTornozeloF
        
    % GRAFICO
        figure(2);
        
        subplot(2,3,1);
        
        plot(Tempo3.signals.values,BinTorDir3.signals.values,'c');
        hold on;
        plot(Tempo4.signals.values,BinTorDir4.signals.values,'b');
        plot(Tempo5.signals.values,BinTorDir5.signals.values,'r');
        plot(Tempo5.signals.values,AngTorDir5.signals.values,'g');
        axis([0 Tempo3.signals.values(size(Tempo3.signals.values,1),1) -12 12]);
        grid on; hold off;
        title('Variacao Binario Tornozelo para Freq dif');
        
        subplot(2,3,4);
        plot(Tempo3.signals.values,BinTorDir3.signals.values / 12 * 100,'c');grid on;
        hold on;
        plot(Tempo4.signals.values,BinTorDir4.signals.values / 12 * 100,'b');grid on;
        plot(Tempo5.signals.values,BinTorDir5.signals.values / 12 * 100,'r');grid on;
        plot(Tempo5.signals.values,AngTorDir5.signals.values,'g');
        axis([0 Tempo3.signals.values(size(Tempo3.signals.values,1),1) -100 100]);
        grid on; hold off;
        title('Variacao Carga Tornozelo para Freq dif');

% JOELHO
    % BINARIO
        BinarioCargaMaximaMinimaMediaServoJoelhoF(1,1) = ...
            max(BinJoeDir3.signals.values);
        BinarioCargaMaximaMinimaMediaServoJoelhoF(1,2) = ...
            min(BinJoeDir3.signals.values);
        BinarioCargaMaximaMinimaMediaServoJoelhoF(1,3) = ...
            sum(BinJoeDir3.signals.values) / size(BinJoeDir3.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoJoelhoF(1,5) = ...
            max(BinJoeDir4.signals.values);
        BinarioCargaMaximaMinimaMediaServoJoelhoF(1,6) = ...
            min(BinJoeDir4.signals.values);
        BinarioCargaMaximaMinimaMediaServoJoelhoF(1,7) = ...
            sum(BinJoeDir4.signals.values) / size(BinJoeDir4.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoJoelhoF(1,9) = ...
            max(BinJoeDir5.signals.values);
        BinarioCargaMaximaMinimaMediaServoJoelhoF(1,10) = ...
            min(BinJoeDir5.signals.values);
        BinarioCargaMaximaMinimaMediaServoJoelhoF(1,11) = ...
            sum(BinJoeDir5.signals.values) / size(BinJoeDir5.signals.values,1);

        
    % CARGA
        BinarioCargaMaximaMinimaMediaServoJoelhoF(2,1) = ...
            max(BinJoeDir3.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoJoelhoF(2,2) = ...
            min(BinJoeDir3.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoJoelhoF(2,3) = ...
            sum(BinJoeDir3.signals.values / 4 * 100) / size(BinJoeDir3.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoJoelhoF(2,5) = ...
            max(BinJoeDir4.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoJoelhoF(2,6) = ...
            min(BinJoeDir4.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoJoelhoF(2,7) = ...
            sum(BinJoeDir4.signals.values / 4 * 100) / size(BinJoeDir4.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoJoelhoF(2,9) = ...
            max(BinJoeDir5.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoJoelhoF(2,10) = ...
            min(BinJoeDir5.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoJoelhoF(2,11) = ...
            sum(BinJoeDir5.signals.values / 4 * 100) / size(BinJoeDir5.signals.values,1);

        
        BinarioCargaMaximaMinimaMediaServoJoelhoF
        
    % GRAFICO
        subplot(2,3,2);
        plot(Tempo3.signals.values,BinJoeDir3.signals.values,'c*');grid on;
        hold on;
        plot(Tempo4.signals.values,BinJoeDir4.signals.values,'b');grid on;
        plot(Tempo5.signals.values,BinJoeDir5.signals.values,'r');grid on;
        plot(Tempo5.signals.values, AngJoeDir5.signals.values/100,'g');
        %axis([0 Tempo3.signals.values(size(Tempo3.signals.values,1),1) -4 4]);
        grid on;hold off;
        title('Variacao Binario Joelho para Freq dif');
        
        subplot(2,3,5);
        plot(Tempo3.signals.values, BinJoeDir3.signals.values / 4 * 100,'c');grid on;
        hold on;
        plot(Tempo4.signals.values, BinJoeDir4.signals.values / 4 * 100,'b');grid on;
        plot(Tempo5.signals.values, BinJoeDir5.signals.values / 4 * 100,'r');grid on;
        plot(Tempo5.signals.values, AngJoeDir5.signals.values,'g');
        axis([0 Tempo3.signals.values(size(Tempo3.signals.values,1),1) -100 100]);
        grid on;hold off;
        title('Variacao Taxa Joelho para Freq dif');
        
%ANCA
    % BINARIO
        BinarioCargaMaximaMinimaMediaServoAncaF(1,1) = ...
            max(BinAncDir3.signals.values);
        BinarioCargaMaximaMinimaMediaServoAncaF(1,2) = ...
            min(BinAncDir3.signals.values);
        BinarioCargaMaximaMinimaMediaServoAncaF(1,3) = ...
            sum(BinAncDir3.signals.values) / size(BinAncDir3.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoAncaF(1,5) = ...
            max(BinAncDir4.signals.values);
        BinarioCargaMaximaMinimaMediaServoAncaF(1,6) = ...
            min(BinAncDir4.signals.values);
        BinarioCargaMaximaMinimaMediaServoAncaF(1,7) = ...
            sum(BinAncDir4.signals.values) / size(BinAncDir4.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoAncaF(1,9) = ...
            max(BinAncDir5.signals.values);
        BinarioCargaMaximaMinimaMediaServoAncaF(1,10) = ...
            min(BinAncDir5.signals.values);
        BinarioCargaMaximaMinimaMediaServoAncaF(1,11) = ...
            sum(BinAncDir5.signals.values) / size(BinAncDir5.signals.values,1);
       
    % CARGA
        BinarioCargaMaximaMinimaMediaServoAncaF(2,1) = ...
            max(BinAncDir3.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoAncaF(2,2) = ...
            min(BinAncDir3.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoAncaF(2,3) = ...
            sum(BinAncDir3.signals.values / 4 * 100) / size(BinAncDir3.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoAncaF(2,5) = ...
            max(BinAncDir4.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoAncaF(2,6) = ...
            min(BinAncDir4.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoAncaF(2,7) = ...
            sum(BinAncDir4.signals.values / 4 * 100) / size(BinAncDir4.signals.values,1);

        BinarioCargaMaximaMinimaMediaServoAncaF(2,9) = ...
            max(BinAncDir5.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoAncaF(2,10) = ...
            min(BinAncDir5.signals.values / 4 * 100);
        BinarioCargaMaximaMinimaMediaServoAncaF(2,11) = ...
            sum(BinAncDir5.signals.values / 4 * 100) / size(BinAncDir5.signals.values,1);

        
        BinarioCargaMaximaMinimaMediaServoAncaF
        
    % GRAFICO
        subplot(2,3,3);
        plot(Tempo3.signals.values, BinAncDir3.signals.values,'c');grid on;
        hold on;
        plot(Tempo4.signals.values, BinAncDir4.signals.values,'b');grid on;
        plot(Tempo5.signals.values, BinAncDir5.signals.values,'r');grid on;
        plot(Tempo5.signals.values, AngAncDir5.signals.values/100,'g');
        axis([0 Tempo3.signals.values(size(Tempo3.signals.values,1),1) -4 4]);
        grid on;hold off;
        title('Variacao Binario Anca para Freq dif');
        
        subplot(2,3,6);
        plot(Tempo3.signals.values, BinAncDir3.signals.values / 4 * 100,'c');grid on;
        hold on;
        plot(Tempo4.signals.values, BinAncDir4.signals.values / 4 * 100,'b');grid on;
        plot(Tempo5.signals.values, BinAncDir5.signals.values / 4 * 100,'r');grid on;
        plot(Tempo5.signals.values, AngAncDir5.signals.values,'g')
        axis([0 Tempo3.signals.values(size(Tempo3.signals.values,1),1) -100 100]);
        grid on;hold off;
        title('Variacao Taxa Anca para Freq dif');
        
        
        
        