Error in fi divide for embedded fi object
Vous suivez désormais cette question
- Les mises à jour seront visibles dans votre flux de contenu suivi.
- Selon vos préférences en matière de communication il est possible que vous receviez des e-mails.
Une erreur s'est produite
Impossible de terminer l’action en raison de modifications de la page. Rechargez la page pour voir sa mise à jour.
0 votes
Partagez un lien vers cette question
For fi objects, B must be a scalar in A/B.
Error in / (line 23)
c = fidivide(a,b);
Réponse acceptée
3 votes
Partagez un lien vers cette réponse
15 commentaires
Partagez un lien vers ce commentaire
Partagez un lien vers ce commentaire
- Are you trying to do code generation? This error only occurs during code generation.
- You have defined the variable power to be floating-point double. Do you want the code to be purely fixed-point?
- Do you want to generate C code? or a MEX function to simulate in MATLAB?
Partagez un lien vers ce commentaire
Partagez un lien vers ce commentaire
- The range of the magnitude of the output is between
and
. This means that you need at least 30 integer bits, and 30 fractional bits in the output. The output is also positive and negative. To accomodate this, I chose a signed fixed-point type with a 64 bit word length and 32 bit fraction length. - You can see in the generated code that the large word length of the output means that multiple words of builtin C types were needed for intermediate products and sums.
- I changed the names of the variables from base, exp, power to b, e, p respectively so the builtin functions of the same name would not be overloaded.
- I separated out the functions that you want to generate code for from the test bench.
- The test bench compiles and runs fixed-point as a MATLAB Executable (MEX).
- The test bench also generates C code for the fixed-point function.
- Run MATLAB script test_bench to test and compile the code.
- Save each of the functions enclosed below in their own file.
Partagez un lien vers ce commentaire
Partagez un lien vers ce commentaire
Partagez un lien vers ce commentaire
Partagez un lien vers ce commentaire
Partagez un lien vers ce commentaire
Partagez un lien vers ce commentaire
Partagez un lien vers ce commentaire
- Debugging data for your reference
Partagez un lien vers ce commentaire
Partagez un lien vers ce commentaire
Partagez un lien vers ce commentaire
Partagez un lien vers ce commentaire
Plus de réponses (0)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Tags
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
