IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

MATLAB Discussion :

importer deux fichiers textes différents pour superposer des courbes


Sujet :

MATLAB

  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    8
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2010
    Messages : 8
    Points : 7
    Points
    7
    Par défaut importer deux fichiers textes différents pour superposer des courbes
    Bonjour,

    voila je suis pas trop à l'aise avec matlab, mais pour mon stage je dois l'utiliser. Comment faire pour superposer plusieurs courbes de fichier textes différents??
    Voici la fonction que l'on a crée pour moi qui permet de visualiser les courbes:

    Merci d'avance.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    close all
    clear all
    %% Paramètres de mesure
    Lfour=19; % Longueur du four (m)
    dt=2; % Intervale de mesure (s)
    voies=5; % Nombre de voies
    VTf=5; % Voies Température ämbiante
    VTc=3; % Voies Température capteur chromé
    VTn=1; % Voies Température capteur noir
    Vphic=4; % Voies flux capteur chromé
    Vphin=2; % Voies flux capteur noir
    Coefn=3.71; % Coefficient de conversion (µV.W^-1.m^2)
    Coefc=3.65; % Coefficient de conversion (µV.W^-1.m^2)
    %% Données brutes
    Fichier='test3.exp';
    data=importdata(Fichier,' ',10+voies)
    data=data.data;
    %Traitement des données
    taille=size(data);
    t=dt*(0:taille(1)-1);
    ttot=max(t);
    Tf=data(:,VTf);
    Tc=data(:,VTc);
    Tn=data(:,VTn);
    phic=data(:,Vphic);
    phin=data(:,Vphin);
    phic=(40.72*phic+3.26)/Coefc;
    phin=(40.72*phin+3.26)/Coefn;
    %% Graphique Température
     
    X1=t;
    YMatrix1=[Tn Tc Tf];
    %CREATEFIGURE(X1,YMATRIX1)
    %  X1:  vector of x data
    %  YMATRIX1:  matrix of y data
     
    %  Auto-generated by MATLAB on 17-Mar-2010 17:51:26
     
    % Create figure
    figure1 = figure;
     
    % Create axes
    axes1 = axes('Parent',figure1,'YGrid','on','XGrid','on');
    box(axes1,'on');
    hold(axes1,'all');
     
    % Create multiple lines using matrix input to plot
    plot1 = plot(X1,YMatrix1,'Parent',axes1);
    set(plot1(1),'DisplayName','Température noir');
    set(plot1(2),'DisplayName','Température Chromé');
    set(plot1(3),'DisplayName','Température four');
     
    % Create xlabel
    xlabel('Temps(s)');
     
    % Create ylabel
    ylabel('Température (°C)');
     
    % Create title
    title(Fichier);
     
    % Create legend
    legend(axes1,'show');
    set(legend,...
        'Position',[0.587946428571427 0.117857142857141 0.304464285714286 0.157738095238095]);
    %% Graphique Flux
    X1=t;
    YMatrix1=[phin phic phin-phic];
    %CREATEFIGURE(X1,YMATRIX1)
    %  X1:  vector of x data
    %  YMATRIX1:  matrix of y data
     
    %  Auto-generated by MATLAB on 17-Mar-2010 18:21:28
     
    % Create figure
    figure1 = figure;
     
    % Create axes
    axes1 = axes('Parent',figure1,'YGrid','on','XGrid','on');
    box(axes1,'on');
    hold(axes1,'all');
     
    % Create multiple lines using matrix input to plot
    plot1 = plot(X1,YMatrix1,'Parent',axes1);
    set(plot1(1),'DisplayName','Flux total');
    set(plot1(2),'DisplayName','Flux convectif');
    set(plot1(3),'DisplayName','Flux de rayonnement');
     
    % Create xlabel
    xlabel('Temps (s)');
     
    % Create ylabel
    ylabel('Densité de flux (W\cdotm^{-2})');
     
    % Create title
    title(Fichier);
     
    % Create legend
    legend(axes1,'show');
    set(legend,...
        'Position',[0.425446428571428 0.129761904761904 0.308035714285714 0.157738095238095]);
     
    %% Graphique Coefficient de transfert
    hc=phic./(Tf-Tc);
    hr=(phin-phic)./(Tf-Tc);
    X1=t;
    YMatrix1=[hc hr];
    %CREATEFIGURE(X1,YMATRIX1)
    %  X1:  vector of x data
    %  YMATRIX1:  matrix of y data
     
    %  Auto-generated by MATLAB on 18-Mar-2010 09:13:37
     
    % Create figure
    figure1 = figure;
     
    % Create axes
    axes1 = axes('Parent',figure1,'YGrid','on','XGrid','on');
    box(axes1,'on');
    hold(axes1,'all');
     
    % Create multiple lines using matrix input to plot
    plot1 = plot(X1,YMatrix1,'Parent',axes1);
    set(plot1(1),'DisplayName','Convection');
    set(plot1(2),'DisplayName','Rayonnement');
     
    % Create xlabel
    xlabel('Temps (s) ');
     
    % Create ylabel
    ylabel('h (W\cdotm^{-2}\cdot°C^{-1})');
     
    % Create title
    title(Fichier);
     
    % Create legend
    legend(axes1,'show');
    set(legend,...
        'Position',[0.371874999999999 0.793154761904762 0.233035714285714 0.108630952380952]);
     
    %% Graphique complet
    X1=t;
    YMatrix1=[Tn Tc Tf];
    YMatrix2=[phin phic phin-phic];
    YMatrix3=[hc hr];
     
    %CREATEFIGURE(X1,YMATRIX1,YMATRIX2,YMATRIX3)
    %  X1:  vector of x data
    %  YMATRIX1:  matrix of y data
    %  YMATRIX2:  matrix of y data
    %  YMATRIX3:  matrix of y data
     
    %  Auto-generated by MATLAB on 18-Mar-2010 09:36:44
     
    % Create figure
    figure1 = figure;
     
    % Create subplot
    subplot1 = subplot(3,1,1,'Parent',figure1,'YGrid','on','XGrid','on');
    box(subplot1,'on');
    hold(subplot1,'all');
     
    % Create multiple lines using matrix input to plot
    plot1 = plot(X1,YMatrix1,'Parent',subplot1);
    set(plot1(1),'DisplayName','Température noir');
    set(plot1(2),'DisplayName','Température chromé');
    set(plot1(3),'DisplayName','Température four');
     
    % Create ylabel
    ylabel('Température (°C)');
     
    % Create title
    title(Fichier);
     
    % Create subplot
    subplot2 = subplot(3,1,2,'Parent',figure1,'YGrid','on','XGrid','on');
    box(subplot2,'on');
    hold(subplot2,'all');
     
    % Create multiple lines using matrix input to plot
    plot2 = plot(X1,YMatrix2,'Parent',subplot2);
    set(plot2(1),'DisplayName','Flux total');
    set(plot2(2),'DisplayName','Flux convectif');
    set(plot2(3),'DisplayName','Flux de rayonnement');
     
    % Create ylabel
    ylabel('Densité de flux (W\cdotm^{-2})');
     
    X1=t;
    % Create subplot
    subplot3 = subplot(3,1,3,'Parent',figure1,'YGrid','on','XGrid','on');
    box(subplot3,'on');
    hold(subplot3,'all');
     
    % Create multiple lines using matrix input to plot
    plot3 = plot(X1,YMatrix3,'Parent',subplot3);
    set(plot3(1),'DisplayName','Convection');
    set(plot3(2),'DisplayName','Rayonnement');
     
    % Create xlabel
    xlabel('Temps (s)');
     
    % Create ylabel
    ylabel('h (W\cdotm^{-2}\cdot°C^{-1})');
     
    % Create legend
    legend(subplot1,'show');
     
    % Create legend
    legend(subplot2,'show');
     
    % Create legend
    legend(subplot3,'show');
    comment faire donc a partir des données ci dessus?

  2. #2
    Membre éclairé
    Profil pro
    Inscrit en
    Mars 2007
    Messages
    640
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2007
    Messages : 640
    Points : 776
    Points
    776
    Par défaut
    Bonjour,


    qu'est ce qui ne marche pas ou que tu ne comprends pas dans le code ?

    Pour la superposition de courbe, regarde la commande hold

  3. #3
    Futur Membre du Club
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    8
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2010
    Messages : 8
    Points : 7
    Points
    7
    Par défaut
    dsl je me suis mal exprimé, en fait tout marche mais j'aurais aimé savoir comment superposer des courbes provenant de données textes isues de fichiers différents, comment l'intégrer dans ce programme. En effet, chaque fichier texte correspondant à une expérience (la superposition me permettra de voir si les courbes ont la même allures par exemple).

    Merci.

  4. #4
    Membre éclairé
    Profil pro
    Inscrit en
    Mars 2007
    Messages
    640
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2007
    Messages : 640
    Points : 776
    Points
    776
    Par défaut
    Dans ce cas, utilise non pas des subplot mais un plot tout simple avec la commande hold.

    ca devrait suffire. Après, faudra peut être bidouiller les axes pour faire coller le tout

Discussions similaires

  1. Réponses: 13
    Dernier message: 15/10/2013, 00h23
  2. Réponses: 7
    Dernier message: 15/10/2012, 01h03
  3. Importer deux fichiers textes
    Par thomas12 dans le forum VB.NET
    Réponses: 1
    Dernier message: 03/11/2009, 13h28
  4. Importer un fichier texte dans des champs d'une table
    Par Cyriusix dans le forum Modélisation
    Réponses: 1
    Dernier message: 17/04/2008, 14h18
  5. Pb pour importer un fichier texte
    Par sam01 dans le forum Requêtes
    Réponses: 2
    Dernier message: 29/09/2005, 13h16

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo