Skip to content
Snippets Groups Projects
prepare_models_part1modifie.m 1.53 KiB
Newer Older
% build dynamics model (part 1)
%modele B1
y_training=zeros(159,1)%zeros(145,1);%zeros(127,1)
C=xlsread('../points_courbes.xls');

% on normalise les patients
J=1;
I=1;
ymax_training=Y;
ymax_training=zeros(22,1);
while (I<=22);
    % on cherche le max du patient
    J=1;
    while (J<=25);
        if Y(J,I) > ymax_training(I,1)
            ymax_training(I,1)=Y(J,I);
        end
        J=J+1;
    end
    
    % on normalise le patient
    J=1;
    while (J<=25);
        Y(J,I) = Y(J,I) / ymax_training(I,1);
        J=J+1;
    end
    
    I=I+1;
end

% on récupère les frames qui nous intéressent
J=1;
I=1;
i=1;
while (I<=22); %on parcourt tout les patients
    J=C(I,1); %on prend que la premiere colonne du .xls
    if C(I,3)>0 %si le patient a un plateau
        while (J<C(I,3)); %on parcourt tout les éléments de la 3ieme colonnes J in 1:element troisieme col
            y_training(i,1)=Y(J,I); %exp patient 1: y_training=une col 
            i=i+1;
            J=J+1;
        end
    else
        while (J<C(I,2));
            y_training(i,1)=Y(J,I);
            i=i+1;
            J=J+1;
        end
    end
    I=I+1;
end
Y_training = y_training;

%creation de X_training
k=1;
X_training=[];
    if C(k,3)>0
Laurie Boffelli's avatar
Laurie Boffelli committed
        X=[0:1/(C(k,3)-C(k,1)-1):1];
        X_training = [X_training, X];
    else
Laurie Boffelli's avatar
Laurie Boffelli committed
        X=[0:1/(C(k,2)-C(k,1)-1):1];
        X_training = [X_training, X];
    end
    k=k+1;
end
X_training=X_training';
%X_training=repmat(X_training,18,1);


save('trainingB1.mat','X_training','Y_training')