Error in fi divide for embedded fi object
Al momento, stai seguendo questa domanda
- Vedrai gli aggiornamenti nel tuofeed del contenuto seguito.
- Potresti ricevere delle e-mail a seconda delle tuepreferenze per le comunicazioni.
Si è verificato un errore
Impossibile completare l'azione a causa delle modifiche apportate alla pagina. Ricarica la pagina per vedere lo stato aggiornato.
0 voti
Condividi un link a questa domanda
For fi objects, B must be a scalar in A/B.
Error in / (line 23)
c = fidivide(a,b);
Risposta accettata
3 voti
Condividi un link a questa risposta
15 Commenti
Condividi un link a questo commento
Condividi un link a questo commento
- 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?
Condividi un link a questo commento
Condividi un link a questo commento
- 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.
Condividi un link a questo commento
Condividi un link a questo commento
Condividi un link a questo commento
Condividi un link a questo commento
Condividi un link a questo commento
Condividi un link a questo commento
Condividi un link a questo commento
- Debugging data for your reference
Condividi un link a questo commento
Condividi un link a questo commento
Condividi un link a questo commento
Condividi un link a questo commento
Più risposte (0)
Categorie
Scopri di più su Logical in Centro assistenza e File Exchange
Tag
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)
