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 :

Je n'ai pas compris l'erreur


Sujet :

MATLAB

  1. #1
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mai 2014
    Messages : 11
    Points : 2
    Points
    2
    Par défaut Je n'ai pas compris l'erreur
    Bonjour,

    Je ne comprends pas où est le problème

    Merci
    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
    function varargout = pfe2014(varargin)
    % PFE2014 MATLAB code for pfe2014.fig
    %      PFE2014, by itself, creates a new PFE2014 or raises the existing
    %      singleton*.
    %
    %      H = PFE2014 returns the handle to a new PFE2014 or the handle to
    %      the existing singleton*.
    %
    %      PFE2014('CALLBACK',hObject,eventData,handles,...) calls the local
    %      function named CALLBACK in PFE2014.M with the given input arguments.
    %
    %      PFE2014('Property','Value',...) creates a new PFE2014 or raises the
    %      existing singleton*.  Starting from the left, property value pairs are
    %      applied to the GUI before pfe2014_OpeningFcn gets called.  An
    %      unrecognized property name or invalid value makes property application
    %      stop.  All inputs are passed to pfe2014_OpeningFcn via varargin.
    %
    %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
    %      instance to run (singleton)".
    %
    % See also: GUIDE, GUIDATA, GUIHANDLES
    % Edit the above text to modify the response to help pfe2014
    % Last Modified by GUIDE v2.5 03-May-2014 15:12:22
    % Begin initialization code - DO NOT EDIT
    gui_Singleton = 1;
    gui_State = struct('gui_Name',       mfilename, ...
                       'gui_Singleton',  gui_Singleton, ...
                       'gui_OpeningFcn', @pfe2014_OpeningFcn, ...
                       'gui_OutputFcn',  @pfe2014_OutputFcn, ...
                       'gui_LayoutFcn',  [] , ...
                       'gui_Callback',   []);
    if nargin && ischar(varargin{1})
        gui_State.gui_Callback = str2func(varargin{1});
    end
    if nargout
        [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    else
        gui_mainfcn(gui_State, varargin{:});
    end
    % End initialization code - DO NOT EDIT
    % --- Executes just before pfe2014 is made visible.
    function pfe2014_OpeningFcn(hObject, eventdata, handles, varargin)
    % This function has no output args, see OutputFcn.
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    % varargin   command line arguments to pfe2014 (see VARARGIN)
    % Choose default command line output for pfe2014
    handles.output = hObject;
    % Update handles structure
    guidata(hObject, handles);
    % UIWAIT makes pfe2014 wait for user response (see UIRESUME)
    % uiwait(handles.figure1);
    % --- Outputs from this function are returned to the command line.
    function varargout = pfe2014_OutputFcn(hObject, eventdata, handles) 
    % varargout  cell array for returning output args (see VARARGOUT);
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    % Get default command line output from handles structure
    varargout{1} = handles.output;
    % --- Executes on selection change in popupmenu1.
    function popupmenu1_Callback(hObject, eventdata, handles)
    % hObject    handle to popupmenu1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
    %        contents{get(hObject,'Value')} returns selected item from popupmenu1
    % --- Executes during object creation, after setting all properties.
    function popupmenu1_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to popupmenu1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
    % Hint: popupmenu controls usually have a white background on Windows.
    %       See ISPC and COMPUTER.
    if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor','white');
    end
    % --- Executes on selection change in popupmenu2.
    function popupmenu2_Callback(hObject, eventdata, handles)
    % hObject    handle to popupmenu2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu2 contents as cell array
    %        contents{get(hObject,'Value')} returns selected item from popupmenu2
    % --- Executes during object creation, after setting all properties.
    function popupmenu2_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to popupmenu2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
    % Hint: popupmenu controls usually have a white background on Windows.
    %       See ISPC and COMPUTER.
    if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor','white');
    end
    % --- Executes on selection change in popupmenu3.
    function popupmenu3_Callback(hObject, eventdata, handles)
    % hObject    handle to popupmenu3 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu3 contents as cell array
    %        contents{get(hObject,'Value')} returns selected item from popupmenu3
    % --- Executes during object creation, after setting all properties.
    function popupmenu3_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to popupmenu3 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
    % Hint: popupmenu controls usually have a white background on Windows.
    %       See ISPC and COMPUTER.
    if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
     
        set(hObject,'BackgroundColor','white');
    end
    function uipanel1_SelectionChangeFcn(hObject, eventdata, handles)
    % hObject    handle to the selected object in uipanel1 
    % eventdata  structure with the following fields (see UIBUTTONGROUP)
    %	EventName: string 'SelectionChanged' (read only)
    %	OldValue: handle of the previously selected object or empty if none was selected
    %	NewValue: handle of the currently selected object
    % handles    structure with handles and user data (see GUIDATA)
    % --- Executes on button press in pushbutton1.
    function pushbutton1_Callback(hObject, eventdata, handles)
    a=get(handles.popupmenu1,'value');
    val=get(handles.popupmenu2,'value');
    pha=get(handles.popupmenu3,'value');
    res=get(handles.uipannel1,'string');
    if res=='Amplitude'
        figure
        result=Exemple1(a);
    elseif a==10 & res=='Phase'
        result=test(pha);
    elseif a==10 & res=='Amplitude&phase'
        figure
        result=code1(pha,val);   
    else
        ms = msgbox('erreur','mesage d erreur');
    end
     
    % hObject    handle to pushbutton1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    % --- Executes on button press in out.
    function out_Callback(hObject, eventdata, handles)
    % hObject    handle to out (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    close(pfe2014);
    % --- Executes on button press in out.
    function choix_Callback(hObject, eventdata, handles)
    % hObject    handle to out (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)

  2. #2
    Invité
    Invité(e)
    Par défaut
    Bonsoir tout d'abord,

    Pourrait-on justement savoir quel est le problème ? Il serait bienvenu de l'expliquer clairement, pas que l'on ait à le deviner.

    En parcourant vite fait ton code, je peux déjà te diriger vers la FAQ :
    Comment comparer des chaines de caractères ?
    et pfe2014 dans la ligne close(pfe2014); serait à replacer par gcbf.

  3. #3
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mai 2014
    Messages : 11
    Points : 2
    Points
    2
    Par défaut bonjour
    bonjour a tous
    je n'ai compris pas si le probème de la comparaison de chaine ou autre car aussi la récupération de donné ne fonctionne pas svp si possible donné une solution

  4. #4
    Rédacteur/Modérateur

    Avatar de Jerome Briot
    Homme Profil pro
    Freelance mécatronique - Conseil, conception et formation
    Inscrit en
    Novembre 2006
    Messages
    20 302
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Freelance mécatronique - Conseil, conception et formation

    Informations forums :
    Inscription : Novembre 2006
    Messages : 20 302
    Points : 53 165
    Points
    53 165
    Par défaut
    La FAQ est pourtant suffisamment claire

    Il faut remplacer

    par

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    strcmp(res, 'Amplitude')
    Ingénieur indépendant en mécatronique - Conseil, conception et formation
    • Conception mécanique (Autodesk Fusion 360)
    • Impression 3D (Ultimaker)
    • Développement informatique (Python, MATLAB, C)
    • Programmation de microcontrôleur (Microchip PIC, ESP32, Raspberry Pi, Arduino…)

    « J'étais le meilleur ami que le vieux Jim avait au monde. Il fallait choisir. J'ai réfléchi un moment, puis je me suis dit : "Tant pis ! J'irai en enfer" » (Saint Huck)

  5. #5
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mai 2014
    Messages : 11
    Points : 2
    Points
    2
    Par défaut
    bonjours,voici les erreurs qui est affiché après l’exécution de cette code svp trouver une solution??
    ??? Reference to non-existent field 'uipannel1'.
    
    Error in ==> interface1>valider_Callback at 153
    res=get(handles.uipannel1,'string');
    
    Error in ==> gui_mainfcn at 96
            feval(varargin{:});
    
    Error in ==> interface1 at 42
        gui_mainfcn(gui_State, varargin{:});
    
    Error in ==> @(hObject,eventdata)interface1('valider_Callback',hObject,eventdata,guidata(hObject))
    
     
    ??? Error while evaluating uicontrol Callback

  6. #6
    Rédacteur/Modérateur

    Avatar de Jerome Briot
    Homme Profil pro
    Freelance mécatronique - Conseil, conception et formation
    Inscrit en
    Novembre 2006
    Messages
    20 302
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Freelance mécatronique - Conseil, conception et formation

    Informations forums :
    Inscription : Novembre 2006
    Messages : 20 302
    Points : 53 165
    Points
    53 165
    Par défaut
    Montre nous le code en entier
    Ingénieur indépendant en mécatronique - Conseil, conception et formation
    • Conception mécanique (Autodesk Fusion 360)
    • Impression 3D (Ultimaker)
    • Développement informatique (Python, MATLAB, C)
    • Programmation de microcontrôleur (Microchip PIC, ESP32, Raspberry Pi, Arduino…)

    « J'étais le meilleur ami que le vieux Jim avait au monde. Il fallait choisir. J'ai réfléchi un moment, puis je me suis dit : "Tant pis ! J'irai en enfer" » (Saint Huck)

  7. #7
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mai 2014
    Messages : 11
    Points : 2
    Points
    2
    Par défaut
    voila lcode finale de l'interface
    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
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    function varargout = interface1(varargin)
    % INTERFACE1 MATLAB code for interface1.fig
    %      INTERFACE1, by itself, creates a new INTERFACE1 or raises the existing
    %      singleton*.
    %
    %      H = INTERFACE1 returns the handle to a new INTERFACE1 or the handle to
    %      the existing singleton*.
    %
    %      INTERFACE1('CALLBACK',hObject,eventData,handles,...) calls the local
    %      function named CALLBACK in INTERFACE1.M with the given input arguments.
    %
    %      INTERFACE1('Property','Value',...) creates a new INTERFACE1 or raises the
    %      existing singleton*.  Starting from the left, property value pairs are
    %      applied to the GUI before interface1_OpeningFcn gets called.  An
    %      unrecognized property name or invalid value makes property application
    %      stop.  All inputs are passed to interface1_OpeningFcn via varargin.
    %
    %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
    %      instance to run (singleton)".
    %
    % See also: GUIDE, GUIDATA, GUIHANDLES
     
    % Edit the above text to modify the response to help interface1
     
    % Last Modified by GUIDE v2.5 14-May-2014 14:18:01
     
    % Begin initialization code - DO NOT EDIT
    gui_Singleton = 1;
    gui_State = struct('gui_Name',       mfilename, ...
                       'gui_Singleton',  gui_Singleton, ...
                       'gui_OpeningFcn', @interface1_OpeningFcn, ...
                       'gui_OutputFcn',  @interface1_OutputFcn, ...
                       'gui_LayoutFcn',  [] , ...
                       'gui_Callback',   []);
    if nargin && ischar(varargin{1})
        gui_State.gui_Callback = str2func(varargin{1});
    end
     
    if nargout
        [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    else
        gui_mainfcn(gui_State, varargin{:});
    end
    % End initialization code - DO NOT EDIT
     
     
    % --- Executes just before interface1 is made visible.
    function interface1_OpeningFcn(hObject, eventdata, handles, varargin)
    % This function has no output args, see OutputFcn.
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    % varargin   command line arguments to interface1 (see VARARGIN)
     
    % Choose default command line output for interface1
    handles.output = hObject;
     
    % Update handles structure
    guidata(hObject, handles);
     
    % UIWAIT makes interface1 wait for user response (see UIRESUME)
    % uiwait(handles.figure1);
     
     
    % --- Outputs from this function are returned to the command line.
    function varargout = interface1_OutputFcn(hObject, eventdata, handles) 
    % varargout  cell array for returning output args (see VARARGOUT);
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Get default command line output from handles structure
    varargout{1} = handles.output;
     
     
    % --- Executes on selection change in antenne.
    function antenne_Callback(hObject, eventdata, handles)
    % hObject    handle to antenne (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hints: contents = cellstr(get(hObject,'String')) returns antenne contents as cell array
    %        contents{get(hObject,'Value')} returns selected item from antenne
     
     
    % --- Executes during object creation, after setting all properties.
    function antenne_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to antenne (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
     
    % Hint: popupmenu controls usually have a white background on Windows.
    %       See ISPC and COMPUTER.
    if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor','white');
    end
     
     
    % --- Executes on selection change in amplitude.
    function amplitude_Callback(hObject, eventdata, handles)
    % hObject    handle to amplitude (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hints: contents = cellstr(get(hObject,'String')) returns amplitude contents as cell array
    %        contents{get(hObject,'Value')} returns selected item from amplitude
     
     
    % --- Executes during object creation, after setting all properties.
    function amplitude_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to amplitude (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
     
    % Hint: popupmenu controls usually have a white background on Windows.
    %       See ISPC and COMPUTER.
    if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor','white');
    end
     
     
    % --- Executes on selection change in phase.
    function phase_Callback(hObject, eventdata, handles)
    % hObject    handle to phase (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hints: contents = cellstr(get(hObject,'String')) returns phase contents as cell array
    %        contents{get(hObject,'Value')} returns selected item from phase
     
     
    % --- Executes during object creation, after setting all properties.
    function phase_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to phase (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
     
    % Hint: popupmenu controls usually have a white background on Windows.
    %       See ISPC and COMPUTER.
    if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor','white');
    end
     
     
    % --- Executes on button press in valider.
    function valider_Callback(hObject, eventdata, handles)
    % hObject    handle to valider (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    a=get(handles.antenne,'value');
    val=get(handles.amplitude,'value');
    pha=get(handles.phase,'value');
    res=get(handles.uipannel1,'string');
    if strcmp(res,'En Amplitude')
        figure
        result=Exemple1(a);
    elseif a==10 & strcmp(res,'En Phase')
        figure
        result=test(pha);
    elseif a==10 & strcmp(res,'En Amplitude&phase')
        figure
        result=test1(pha,val);   
    else
        ms = msgbox('erreur','mesage d erreur');
    end
     
     
     
     
    % --- Executes on button press in reset.
    function reset_Callback(hObject, eventdata, handles)
    % hObject    handle to reset (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
     
     
    function edit1_Callback(hObject, eventdata, handles)
    % hObject    handle to edit1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hints: get(hObject,'String') returns contents of edit1 as text
    %        str2double(get(hObject,'String')) returns contents of edit1 as a double
     
     
    % --- Executes during object creation, after setting all properties.
    function edit1_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to edit1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
     
    % Hint: edit controls usually have a white background on Windows.
    %       See ISPC and COMPUTER.
    if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor','white');
    end
     
     
     
    function edit2_Callback(hObject, eventdata, handles)
    % hObject    handle to edit2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hints: get(hObject,'String') returns contents of edit2 as text
    %        str2double(get(hObject,'String')) returns contents of edit2 as a double
     
     
    % --- Executes during object creation, after setting all properties.
    function edit2_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to edit2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
     
    % Hint: edit controls usually have a white background on Windows.
    %       See ISPC and COMPUTER.
    if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor','white');
    end
     
     
    % --- Executes when selected object is changed in uipanel1.
    function uipanel1_SelectionChangeFcn(hObject, eventdata, handles)
    % hObject    handle to the selected object in uipanel1 
    % eventdata  structure with the following fields (see UIBUTTONGROUP)
    %	EventName: string 'SelectionChanged' (read only)
    %	OldValue: handle of the previously selected object or empty if none was selected
    %	NewValue: handle of the currently selected object
    % handles    structure with handles and user data (see GUIDATA)

  8. #8
    Rédacteur/Modérateur

    Avatar de Jerome Briot
    Homme Profil pro
    Freelance mécatronique - Conseil, conception et formation
    Inscrit en
    Novembre 2006
    Messages
    20 302
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Freelance mécatronique - Conseil, conception et formation

    Informations forums :
    Inscription : Novembre 2006
    Messages : 20 302
    Points : 53 165
    Points
    53 165
    Par défaut
    L'objet uipannel1 existe-t-il toujours ou bien l'as-tu supprimé ?
    Ingénieur indépendant en mécatronique - Conseil, conception et formation
    • Conception mécanique (Autodesk Fusion 360)
    • Impression 3D (Ultimaker)
    • Développement informatique (Python, MATLAB, C)
    • Programmation de microcontrôleur (Microchip PIC, ESP32, Raspberry Pi, Arduino…)

    « J'étais le meilleur ami que le vieux Jim avait au monde. Il fallait choisir. J'ai réfléchi un moment, puis je me suis dit : "Tant pis ! J'irai en enfer" » (Saint Huck)

  9. #9
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mai 2014
    Messages : 11
    Points : 2
    Points
    2
    Par défaut voila lcode finale de l'interface
    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
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    function varargout = interface1(varargin)
    % INTERFACE1 MATLAB code for interface1.fig
    %      INTERFACE1, by itself, creates a new INTERFACE1 or raises the existing
    %      singleton*.
    %
    %      H = INTERFACE1 returns the handle to a new INTERFACE1 or the handle to
    %      the existing singleton*.
    %
    %      INTERFACE1('CALLBACK',hObject,eventData,handles,...) calls the local
    %      function named CALLBACK in INTERFACE1.M with the given input arguments.
    %
    %      INTERFACE1('Property','Value',...) creates a new INTERFACE1 or raises the
    %      existing singleton*.  Starting from the left, property value pairs are
    %      applied to the GUI before interface1_OpeningFcn gets called.  An
    %      unrecognized property name or invalid value makes property application
    %      stop.  All inputs are passed to interface1_OpeningFcn via varargin.
    %
    %      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
    %      instance to run (singleton)".
    %
    % See also: GUIDE, GUIDATA, GUIHANDLES
     
    % Edit the above text to modify the response to help interface1
     
    % Last Modified by GUIDE v2.5 14-May-2014 14:18:01
     
    % Begin initialization code - DO NOT EDIT
    gui_Singleton = 1;
    gui_State = struct('gui_Name',       mfilename, ...
                       'gui_Singleton',  gui_Singleton, ...
                       'gui_OpeningFcn', @interface1_OpeningFcn, ...
                       'gui_OutputFcn',  @interface1_OutputFcn, ...
                       'gui_LayoutFcn',  [] , ...
                       'gui_Callback',   []);
    if nargin && ischar(varargin{1})
        gui_State.gui_Callback = str2func(varargin{1});
    end
     
    if nargout
        [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
    else
        gui_mainfcn(gui_State, varargin{:});
    end
    % End initialization code - DO NOT EDIT
     
     
    % --- Executes just before interface1 is made visible.
    function interface1_OpeningFcn(hObject, eventdata, handles, varargin)
    % This function has no output args, see OutputFcn.
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    % varargin   command line arguments to interface1 (see VARARGIN)
     
    % Choose default command line output for interface1
    handles.output = hObject;
     
    % Update handles structure
    guidata(hObject, handles);
     
    % UIWAIT makes interface1 wait for user response (see UIRESUME)
    % uiwait(handles.figure1);
     
     
    % --- Outputs from this function are returned to the command line.
    function varargout = interface1_OutputFcn(hObject, eventdata, handles) 
    % varargout  cell array for returning output args (see VARARGOUT);
    % hObject    handle to figure
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Get default command line output from handles structure
    varargout{1} = handles.output;
     
     
    % --- Executes on selection change in antenne.
    function antenne_Callback(hObject, eventdata, handles)
    % hObject    handle to antenne (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hints: contents = cellstr(get(hObject,'String')) returns antenne contents as cell array
    %        contents{get(hObject,'Value')} returns selected item from antenne
     
     
    % --- Executes during object creation, after setting all properties.
    function antenne_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to antenne (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
     
    % Hint: popupmenu controls usually have a white background on Windows.
    %       See ISPC and COMPUTER.
    if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor','white');
    end
     
     
    % --- Executes on selection change in amplitude.
    function amplitude_Callback(hObject, eventdata, handles)
    % hObject    handle to amplitude (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hints: contents = cellstr(get(hObject,'String')) returns amplitude contents as cell array
    %        contents{get(hObject,'Value')} returns selected item from amplitude
     
     
    % --- Executes during object creation, after setting all properties.
    function amplitude_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to amplitude (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
     
    % Hint: popupmenu controls usually have a white background on Windows.
    %       See ISPC and COMPUTER.
    if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor','white');
    end
     
     
    % --- Executes on selection change in phase.
    function phase_Callback(hObject, eventdata, handles)
    % hObject    handle to phase (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hints: contents = cellstr(get(hObject,'String')) returns phase contents as cell array
    %        contents{get(hObject,'Value')} returns selected item from phase
     
     
    % --- Executes during object creation, after setting all properties.
    function phase_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to phase (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
     
    % Hint: popupmenu controls usually have a white background on Windows.
    %       See ISPC and COMPUTER.
    if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor','white');
    end
     
     
    % --- Executes on button press in valider.
    function valider_Callback(hObject, eventdata, handles)
    % hObject    handle to valider (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
    a=get(handles.antenne,'value');
    val=get(handles.amplitude,'value');
    pha=get(handles.phase,'value');
    res=get(handles.uipannel1,'string');
    if strcmp(res,'En Amplitude')
        figure
        result=Exemple1(a);
    elseif a==10 & strcmp(res,'En Phase')
        figure
        result=test(pha);
    elseif a==10 & strcmp(res,'En Amplitude&phase')
        figure
        result=test1(pha,val);   
    else
        ms = msgbox('erreur','mesage d erreur');
    end
     
     
     
     
    % --- Executes on button press in reset.
    function reset_Callback(hObject, eventdata, handles)
    % hObject    handle to reset (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
     
     
    function edit1_Callback(hObject, eventdata, handles)
    % hObject    handle to edit1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hints: get(hObject,'String') returns contents of edit1 as text
    %        str2double(get(hObject,'String')) returns contents of edit1 as a double
     
     
    % --- Executes during object creation, after setting all properties.
    function edit1_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to edit1 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
     
    % Hint: edit controls usually have a white background on Windows.
    %       See ISPC and COMPUTER.
    if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor','white');
    end
     
     
     
    function edit2_Callback(hObject, eventdata, handles)
    % hObject    handle to edit2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    structure with handles and user data (see GUIDATA)
     
    % Hints: get(hObject,'String') returns contents of edit2 as text
    %        str2double(get(hObject,'String')) returns contents of edit2 as a double
     
     
    % --- Executes during object creation, after setting all properties.
    function edit2_CreateFcn(hObject, eventdata, handles)
    % hObject    handle to edit2 (see GCBO)
    % eventdata  reserved - to be defined in a future version of MATLAB
    % handles    empty - handles not created until after all CreateFcns called
     
    % Hint: edit controls usually have a white background on Windows.
    %       See ISPC and COMPUTER.
    if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
        set(hObject,'BackgroundColor','white');
    end
     
     
    % --- Executes when selected object is changed in uipanel1.
    function uipanel1_SelectionChangeFcn(hObject, eventdata, handles)
    % hObject    handle to the selected object in uipanel1 
    % eventdata  structure with the following fields (see UIBUTTONGROUP)
    %	EventName: string 'SelectionChanged' (read only)
    %	OldValue: handle of the previously selected object or empty if none was selected
    %	NewValue: handle of the currently selected object
    % handles    structure with handles and user data (see GUIDATA)

  10. #10
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mai 2014
    Messages : 11
    Points : 2
    Points
    2
    Par défaut
    l uipannel1 existe toujours parce que contient les bouton radio il facilite le teste de choix

  11. #11
    Rédacteur/Modérateur

    Avatar de Jerome Briot
    Homme Profil pro
    Freelance mécatronique - Conseil, conception et formation
    Inscrit en
    Novembre 2006
    Messages
    20 302
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Freelance mécatronique - Conseil, conception et formation

    Informations forums :
    Inscription : Novembre 2006
    Messages : 20 302
    Points : 53 165
    Points
    53 165
    Par défaut
    Pourrais-tu nous fournir le fichier interface1.fig mis dans une archive zip ou rar ?
    Ingénieur indépendant en mécatronique - Conseil, conception et formation
    • Conception mécanique (Autodesk Fusion 360)
    • Impression 3D (Ultimaker)
    • Développement informatique (Python, MATLAB, C)
    • Programmation de microcontrôleur (Microchip PIC, ESP32, Raspberry Pi, Arduino…)

    « J'étais le meilleur ami que le vieux Jim avait au monde. Il fallait choisir. J'ai réfléchi un moment, puis je me suis dit : "Tant pis ! J'irai en enfer" » (Saint Huck)

  12. #12
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mai 2014
    Messages : 11
    Points : 2
    Points
    2
    Par défaut
    interface1.rar

    est ce que voulez vous de transmettre les autres fichiers (exemple1.m,test.m,test1.m)??

  13. #13
    Rédacteur/Modérateur

    Avatar de Jerome Briot
    Homme Profil pro
    Freelance mécatronique - Conseil, conception et formation
    Inscrit en
    Novembre 2006
    Messages
    20 302
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Freelance mécatronique - Conseil, conception et formation

    Informations forums :
    Inscription : Novembre 2006
    Messages : 20 302
    Points : 53 165
    Points
    53 165
    Par défaut
    L'erreur se trouve ici :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    res=get(handles.uipannel1,'string');
    Mais le code est de toute façon incorrect.

    Il faut faire :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    h = get(handles.uipanel1, 'SelectedObject')
    res = get(h, 'String');
    D'autre part, la ligne suivante :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    elseif a==10 & strcmp(res,'En Amplitude&phase')
    devrait plutôt s'écrire :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    elseif a==10 & strcmp(res,'En Amplitude & Phase')
    Pour finir, tu n'utilises pas la bonne méthode pour récupérer les éléments des listbox. Tu dois faire ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    val = get(handles.antenne,'value');
    str = get(handles.antenne, 'String');
     
    a = str{val}
    La variable a contiendra alors une chaine de caractère. Tu devras donc aussi faire la comparaison avec strcmp ou bien la convertir en valeur numérique avec str2double.
    Ingénieur indépendant en mécatronique - Conseil, conception et formation
    • Conception mécanique (Autodesk Fusion 360)
    • Impression 3D (Ultimaker)
    • Développement informatique (Python, MATLAB, C)
    • Programmation de microcontrôleur (Microchip PIC, ESP32, Raspberry Pi, Arduino…)

    « J'étais le meilleur ami que le vieux Jim avait au monde. Il fallait choisir. J'ai réfléchi un moment, puis je me suis dit : "Tant pis ! J'irai en enfer" » (Saint Huck)

  14. #14
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mai 2014
    Messages : 11
    Points : 2
    Points
    2
    Par défaut
    merci vous pouvez m'expliquer davantage comment je fais la conversion en double parce que j'ai essayé de nouveau et j'ai une erreur qui se présente voila l'erreur
    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
    ??? Undefined variable str2double.
     
    Error in ==> interface1>valider_Callback at 153
    a = str2double{val}
     
    Error in ==> gui_mainfcn at 96
            feval(varargin{:});
     
    Error in ==> interface1 at 42
        gui_mainfcn(gui_State, varargin{:});
     
    Error in ==> @(hObject,eventdata)interface1('valider_Callback',hObject,eventdata,guidata(hObject))
     
     
    ??? Error while evaluating uicontrol Callback

  15. #15
    Rédacteur/Modérateur

    Avatar de Jerome Briot
    Homme Profil pro
    Freelance mécatronique - Conseil, conception et formation
    Inscrit en
    Novembre 2006
    Messages
    20 302
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Freelance mécatronique - Conseil, conception et formation

    Informations forums :
    Inscription : Novembre 2006
    Messages : 20 302
    Points : 53 165
    Points
    53 165
    Par défaut
    Citation Envoyé par najla najoula Voir le message
    merci vous pouvez m'expliquer davantage comment je fais la conversion en double parce que j'ai essayé de nouveau et j'ai une erreur qui se présente voila l'erreur
    Je ne peux pas t'expliquer plus que je que j'ai déjà fais. A toi de réfléchir. Ce n'est quand même pas si compliqué avec le dernier morceau de code que j'ai posté

    Si j'ai pris le temps d'écrire ceci :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    val = get(handles.antenne,'value');
    str = get(handles.antenne, 'String');
     
    a = str{val}
    Ce n'est pas pour rien !

    Cherche "uicontrol properties" dans la documentation de MATLAB pour savoir à quoi correspondent les propriétés Value et String
    Ingénieur indépendant en mécatronique - Conseil, conception et formation
    • Conception mécanique (Autodesk Fusion 360)
    • Impression 3D (Ultimaker)
    • Développement informatique (Python, MATLAB, C)
    • Programmation de microcontrôleur (Microchip PIC, ESP32, Raspberry Pi, Arduino…)

    « J'étais le meilleur ami que le vieux Jim avait au monde. Il fallait choisir. J'ai réfléchi un moment, puis je me suis dit : "Tant pis ! J'irai en enfer" » (Saint Huck)

  16. #16
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mai 2014
    Messages : 11
    Points : 2
    Points
    2
    Par défaut
    peut être ce n'est pas compliqué et vous avez raison mais je vous assure que c'est la première fois que je travaille avec Malab pour faire des interfaces graphiques de plus j'ai plus de temps le dépôt de mon travail demain je suis pressé et stressé on ne peut parler avec skype svp

  17. #17
    Invité
    Invité(e)
    Par défaut
    Citation Envoyé par Dut Voir le message
    a = str{val}
    Attention cette syntaxe avec les accolades n'est valide que si la listbox n'est pas en mode multisélection. Dans le cas contraire, il est préférable d'utiliser des parenthèses

  18. #18
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mai 2014
    Messages : 11
    Points : 2
    Points
    2
    Par défaut
    j'ai remplacé les {} par les () j'ai toujours une erreur qui se présente vous pouvez m'aider svp je peux vous envoyer la fonction et vous pouvez egalement consulter l'interface pour comprendre l'idée et de quoi il s'agit

  19. #19
    Invité
    Invité(e)
    Par défaut
    Si c'est la même erreur concernant str2double, c'est une fonction MATLAB est non une variable. Recopie bien le code de Dut.

  20. #20
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2014
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mai 2014
    Messages : 11
    Points : 2
    Points
    2
    Par défaut
    je vous explique le défaut ne provient pas des () mais pour le moment ça concerne les fonctions qu'on va appeler suite à la validation de l'utilisateur avec le bouton valider . svp j'ai envoyé toutes les fonctions pourriez-vous corriger les erreurs s'il y en a ?

    la problème dans la fonction qui va appeler voila le code correspondant svp
    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
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    function result= Example1(a)
     
     
    clear all
     
    %__________________________________________________________________________
    %Loading the required orthogonal data from specific file location.
    %_______________________________________________________________________
    if a/2==4
    h=load('tt1.txt'); 
    end
     
    %Initializing the LD1 and the center value for all parameters
     
    rr=0.9;
    Nelements= a/2;
    phi1=0;
    phi2=76*pi/180;
    dphi=0.007;  %This dphi gives is the one used by Aqeel. We get
                 % exactly as his results. Using dphi=0.01 gives better
                 % results!!!!
     
    LD1=0.9/4;
    for i=1:Nelements
    center(i)=0.55;
    end
     
    %Setting the maximum number of iterations
     
    niter=100;
     
    %__________________________________________________________________________
    %
    % Changing the Orthogonal array to coressponding levels for each iteration . 
    %__________________________________________________________________________
     
    for J=1:niter    %J is the iteration counter
     
        for j=1:Nelements          %  Number of columns of the orthogonal array. 
     
            for i=1:27        %  Number of rows of the orthogonal array.
     
                if h(i,j)==0         
                    r(i,j)= center(j)-((rr^(J-1)).*LD1);          
                    if r(i,j)<0.1         
                        r(i,j)=0.1;         
                    elseif r(i,j)>1          
                        r(i,j)=1;          
                    end
     
     
                elseif h(i,j)==1           
                    r(i,j)=center(j);           
                    if r(i,j)<0.1
                        r(i,j)=0.1;
                    elseif r(i,j)>1
                        r(i,j)=1;
                    end
     
                else
     
                    r(i,j)= center(j)+((rr^(J-1)).*LD1);
                       if r(i,j)<0.1
                        r(i,j)=0.1;
                    elseif r(i,j)>1
                        r(i,j)=1;
                    end
     
                end
     
            end 
     
        end
     
    for i=1:27
     
    b=0;
        for phi=phi1:dphi:phi2
        b=b+1;
        af(b)=0.; 
     
    for j=1:Nelements
        af(b)=af(b)+2*r(i,j)*cos((j-0.5)*pi*cos(phi));
    end
        end
     
    AFMAX=0;
    for j=1:Nelements
        AFMAX=AFMAX+2*r(i,j);
    end
     
     
        %fit(i)=max(20*log10(abs(af)));
        fit(i)=max(20*log10(abs(af)/AFMAX));
     
    end
     
    n=-fit;
     
     for i=1:27                 
            for j=1:Nelements
     
                if h(i,j)==0
                    U(i,j)=n(i);          
     
                elseif h(i,j)==1
                    U1(i,j)=n(i);  
     
                else
                    U2(i,j)=n(i);
     
                end
     
            end       
        end
     
     
        UU=(sum(U)/9);    
        UU1=(sum(U1)/9);    
        UU2=(sum(U2)/9);
     
     
     
     
         for p=1:Nelements
     
            if UU(p)>UU1(p) & UU(p)>UU2(p)  
                center(p)=center(p)-((rr^(J-1)).*LD1);    
            end
     
            if  UU1(p)>UU(p) & UU1(p)>UU2(p)    
                center(p)=center(p);   
            end
     
            if  UU2(p)>UU(p) & UU2(p)>UU1(p)            
                center(p)=center(p)+((rr^(J-1)).*LD1);;   
            end
     
         end
     
     
     
         b=0;
        for phi=phi1:dphi:phi2
        b=b+1;
        af2(b)=0.; 
     
    for j=1:Nelements
        af2(b)=af2(b)+2*center(j)*cos((j-0.5)*pi*cos(phi));
    end
        end
     
    AFMAX2=0;
    for j=1:Nelements
        AFMAX2=AFMAX2+2*center(j);
    end
     
     
        %optSLL(J)=max(20*log10(abs(af)));
        optSLL(J)=max(20*log10(abs(af2)/AFMAX2));
     
     
        %------------------------
     
        phi=0:dphi:pi;
     
        opt=0;
        for i=1:Nelements
     
               opt=opt+center(i)*cos(pi*(i-0.5)*cos(phi)) ;
     
        end
     
    B=20*log10(abs(opt)/max(opt));
     
    plot(phi/pi*180,B)
     
    axis([0 180 -50 0])
    pause(.1)
     
        %---------------------------
     
    end
     
    fprintf('the optimum values of Xi are')
    center/max(center)
     
    %Evaluating the fitness function for the optimum values of the parameters
     
     
    phi=0:dphi:pi;
     
        opt2=0;
        for i=1:Nelements
     
               opt2=opt2+center(i)*cos(pi*(i-0.5)*cos(phi)) ;
     
        end
     
    B=20*log10(abs(opt2)/max(opt2));
     
    plot(phi/pi*180,B)
     
    axis([0 180 -40 0])
     
    hold on
     
     
    af3=0;
    for i=1:Nelements
        af3=af3+cos(pi*(i-0.5)*cos(phi));
    end
     
    B2=20*log10(abs(af3)/max(af3));
    fprintf('The max SLL for the uniform array')
    ii=round(phi2/dphi);
    SLL=max(B2(1:ii))
     
    plot(phi/pi*180,B2,'red')
    grid
    ylabel('AF (dB)')
    xlabel('Azimuth Angle (deg)')
    legend('Taguchi','Uniform')
     
    figure
     
    fprintf('The max SLL for the optimized array')
    optSLL(niter)
     
    % Sotiris, the convergence plot values are stored in the array optSLL
     
    plot(optSLL)
    grid
    ylabel('Fitness function')
    xlabel('Number of iterations')
     
    end

Discussions similaires

  1. message erreur pas compris
    Par heart100 dans le forum Firebird
    Réponses: 5
    Dernier message: 11/03/2015, 18h05
  2. [Débutant] problème d'une erreur et je n'ai pas compris qu'est ce qu'il faut changer ?
    Par Riahi_khoubeib dans le forum VB.NET
    Réponses: 3
    Dernier message: 24/02/2014, 17h24
  3. Msg d'erreur n'est pas compris
    Par nanouchg dans le forum Interfaces Graphiques
    Réponses: 3
    Dernier message: 18/03/2011, 14h29
  4. Réponses: 1
    Dernier message: 17/10/2007, 09h31
  5. Debutant , j'ai pas compris cette erreur
    Par StyleXP dans le forum Langage
    Réponses: 11
    Dernier message: 05/09/2006, 20h45

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