1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
| clear all
close all
% Choix du fichier :
[FileName,PathName] = uigetfile('*.dat','sélectionnez le fichier texte');
fid=fopen(fullfile(PathName,FileName),'r');
% Lecture du fichier :
C = textscan(fid,'%s %s %s','headerlines',1);
% Concaténation :
C = [C{:}];
% On stocke le nombre de lignes :
% nLignes = length(C);
% capteur = C(18,3);
% T = strcmp(capteur,'SAM_8108');
LO = C(49:557,1);
ED1 = C(49:557,2);
LOlu = C(616:1124,1);
LU1 = C(616:1124,2);
ED2 = C(1177:1685,2);
LU2 = C(1744:2252,2);
ED3 = C(2305:2813,2);
LU3 = C(2872:3380,2);
% Conversion en double :
LO = str2double(LO);
ED1 = str2double(ED1);
LOlu = str2double(LOlu);
LU1 = str2double(LU1);
ED2 = str2double(ED2);
ED3 = str2double(ED3);
LU2 = str2double(LU2);
LU3 = str2double(LU3);
% On prends les valeurs max pour les graphiques
EDmax = max(ED1);
LUmax = max(LU3);
% On construit le spectre moyen :
MoyED = (ED1 + ED2 + ED3)/3;
MoyLU = (LU1 + LU2 + LU3)/3;
% On représente sur des graphiques :
subplot(2,2,1), plot(LO,ED1,'b.-',LO,ED2,'g.-',LO,ED3,'r.-');
axis([300 1000 0 EDmax]);
subplot(2,2,2), plot(LOlu,LU1,'b.-',LO,LU2,'g.-',LO,LU3,'r.-');
axis([300 1000 0 LUmax]);
subplot(2,2,3), plot(LO,MoyED,'k.-');
axis([300 1000 0 EDmax]);
subplot(2,2,4), plot(LO,MoyLU,'k.-');
axis([300 1000 0 LUmax]); |
Partager