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

Signal Discussion :

le code de c++ au matlab


Sujet :

Signal

  1. #1
    Nouveau Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mars 2016
    Messages
    1
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Mars 2016
    Messages : 1
    Points : 1
    Points
    1
    Par défaut le code de c++ au matlab
    Bonjour,

    Je suis étudiante en master 2 aérospatiale, j'ai un programme c++ pour mon projet mais vu que j'ai pas fais la programmation c++ avant et je suis débutante dans matlab j'arrive pas a convertir mon programme de c++ au matlab.
    je vous mets le fichier du code dans ce message et je vous demande de bien vouloir m'aider a résoudre ce problème et m'expliquer si c'est possible l’erreur trouvée.

    Code C++ : 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
    #ifndef DUBINS_H
    #define DUBINS_H
     
    // Path types
    #define LSL (0)
    #define LSR (1)
    #define RSL (2)
    #define RSR (3)
    #define RLR (4)
    #define LRL (5)
     
    // Error codes
    #define EDUBOK        (0)   // No error
    #define EDUBCOCONFIGS (1)   // Colocated configurations
    #define EDUBPARAM     (2)   // Path parameterisitation error
    #define EDUBBADRHO    (3)   // the rho value is invalid
    #define EDUBNOPATH    (4)   // no connection between configurations with this word
     
    // The various types of solvers for each of the path types
    typedef int (*DubinsWord)(double, double, double, double* );
     
    // A complete list of the possible solvers that could give optimal paths 
    extern DubinsWord dubins_words[]; 
     
    typedef struct
    {
        double qi[3];       // the initial configuration
        double param[3];    // the lengths of the three segments
        double rho;         // model forward velocity / model angular velocity
        int type;           // path type. one of LSL, LSR, ... 
    } DubinsPath;
     
    /**
     * Callback function for path sampling
     *
     * @note the q parameter is a configuration
     * @note the t parameter is the distance along the path
     * @note the user_data parameter is forwarded from the caller
     * @note return non-zero to denote sampling should be stopped
     */
    typedef int (*DubinsPathSamplingCallback)(double q[3], double t, void* user_data);
     
    /**
     * Generate a path from an initial configuration to
     * a target configuration, with a specified maximum turning
     * radii
     *
     * A configuration is (x, y, theta), where theta is in radians, with zero
     * along the line x = 0, and counter-clockwise is positive
     *
     * @param q0    - a configuration specified as an array of x, y, theta
     * @param q1    - a configuration specified as an array of x, y, theta
     * @param rho   - turning radius of the vehicle (forward velocity divided by maximum angular velocity)
     * @param path  - the resultant path
     * @return      - non-zero on error
     */
    int dubins_init( double q0[3], double q1[3], double rho, DubinsPath* path);
     
    /**
     * Calculate the length of an initialised path
     *
     * @param path - the path to find the length of
     */
    double dubins_path_length( DubinsPath* path );
     
    /**
     * Extract an integer that represents which path type was used
     *
     * @param path    - an initialised path
     * @return        - one of LSL, LSR, RSL, RSR, RLR or LRL (ie/ 0-5 inclusive)
     */
    int dubins_path_type( DubinsPath * path );
     
    /**
     * Calculate the configuration along the path, using the parameter t
     *
     * @param path - an initialised path
     * @param t    - a length measure, where 0 <= t < dubins_path_length(path)
     * @param q    - the configuration result
     * @returns    - non-zero if 't' is not in the correct range
     */
    int dubins_path_sample( DubinsPath* path, double t, double q[3]);
     
    /**
     * Walk along the path at a fixed sampling interval, calling the
     * callback function at each interval
     *
     * @param path      - the path to sample
     * @param cb        - the callback function to call for each sample
     * @param user_data - optional information to pass on to the callback
     * @param stepSize  - the distance along the path for subsequent samples
     */
    int dubins_path_sample_many( DubinsPath* path, DubinsPathSamplingCallback cb, double stepSize, void* user_data );
     
    /**
     * Convenience function to identify the endpoint of a path
     *
     * @param path - an initialised path
     * @param q    - the configuration result
     */
    int dubins_path_endpoint( DubinsPath* path, double q[3] );
     
    /**
     * Convenience function to extract a subset of a path
     *
     * @param path    - an initialised path
     * @param t       - a length measure, where 0 < t < dubins_path_length(path)
     * @param newpath - the resultant path
     */
    int dubins_extract_subpath( DubinsPath* path, double t, DubinsPath* newpath );
     
    // Only exposed for testing purposes
    int dubins_LSL( double alpha, double beta, double d, double* outputs );
    int dubins_RSR( double alpha, double beta, double d, double* outputs );
    int dubins_LSR( double alpha, double beta, double d, double* outputs );
    int dubins_RSL( double alpha, double beta, double d, double* outputs );
    int dubins_LRL( double alpha, double beta, double d, double* outputs );
    int dubins_RLR( double alpha, double beta, double d, double* outputs );
     
    #endif // DUBINS_H
    Je vous prie d'agréer mes salutations les plus distinguées.

    Cordialement m.ouassila

  2. #2
    Expert éminent sénior
    Avatar de Auteur
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    7 648
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 7 648
    Points : 11 137
    Points
    11 137
    Par défaut
    Bonsoir,

    le fichier posté est un fichier de prototypes C++ (extension .h).
    La seule chose qui peut être converti en matlab est la structure :
    Code C++ : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    typedef struct
    {
        double qi[3];       // the initial configuration
        double param[3];    // the lengths of the three segments
        double rho;         // model forward velocity / model angular velocity
        int type;           // path type. one of LSL, LSR, ... 
    } DubinsPath;
    donne en matlab :

    Code matlab : Sélectionner tout - Visualiser dans une fenêtre à part
    DubinsPath=struct('qi',{[]}, 'param',{[]}, 'rho',{}, 'type',{});

    Tout ce qui est #define sont des "constantes" C++ (en réalité des macros), à voir en fonction du contexte.
    Le reste est ce que l'on appelle le prototypage des fonctions.

Discussions similaires

  1. Code qui fonctionne sur Matlab 7.1 mais pas sur R2009b?
    Par kariboubou dans le forum MATLAB
    Réponses: 1
    Dernier message: 19/06/2011, 19h11
  2. code source jpeg sous matlab
    Par cerise16 dans le forum Traitement d'images
    Réponses: 1
    Dernier message: 02/05/2010, 17h51
  3. code de Cryptage en Matlab
    Par xtimas dans le forum MATLAB
    Réponses: 2
    Dernier message: 03/03/2010, 12h34
  4. [Débutant] code de matrice sous Matlab
    Par Alyaoui dans le forum MATLAB
    Réponses: 7
    Dernier message: 30/12/2009, 18h28
  5. Code C à partir de MATLAB
    Par orochimaru13 dans le forum MATLAB
    Réponses: 2
    Dernier message: 26/04/2007, 09h11

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