Hallo, ich möchte mittels Matlab Fixed-Point Formate optimieren und habe ein Problem, da ich keine Konstante definieren kann. In dem folgenden Beispiel soll die Eingangsfolge (Q15 Format) mit der Konstanten 0.9 multipliziert werden. Da die Konstante positive und kleiner 1 ist, kann das Ergbnis ohne Fehler ebenfalls im Q15-Format dargestellt werden. Matlab behandelt die Konstante jedoch als Variable und führt somit eine Multiplikation von zwei Q15 Werten durch, die einen Wert im Q14-Format ergibt (-1 * -1 = 1, 1 ist nicht in Q15) Wenn ich Matlab beibringen könnte, dass 0.9 sich nie ändert sollte das Ergebnis ebenfalls im Q15 Format sein. Hat jemand eine Idee wie man das machen könnte? Danke! clc WordLen = 16; FracLen = 15; Signed = 1; F = fimath('ProductMode', 'KeepMSB', ... 'ProductWordLength', WordLen,... 'SumMode', 'KeepMSB', ... 'SumWordLength', WordLen,... 'OverFlowMode', 'wrap',... 'Roundmode', 'fix'); % create Floatin-Point values aFL = -0.9 : 0.1 : 0.9; % create Fixed-Point values aFI = fi(aFL, Signed, WordLen, FracLen, 'fimath',F); % Floating-Point operation cFL = 0.9 * aFL; % Convert Floating-Point result to Fixed-Point cFI = fi(cFL, Signed, WordLen, 'fimath',F); % Fixed-Point operation dFI = 0.9 * aFI; numerictype(cFI) % DataTypeMode: Fixed-point: binary point scaling % Signed: true % WordLength: 16 % FractionLength: 15 numerictype(dFI) % DataTypeMode: Fixed-point: binary point scaling % Signed: true % WordLength: 16 % FractionLength: 14
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.