Issue with fixed point code generation

2 ビュー (過去 30 日間)
RAVINDRANATH REDDY SUDA
RAVINDRANATH REDDY SUDA 2013 年 5 月 28 日
Hi,
In fixed point model, inputs values are provided as 60,110,150,160,20,166,130. Expected result is 200 and it is shown exactly in simulation result.
But in generated code, the input values are displayed as 503316480,922746880,1258291200,1342177280,167772160,1392508928,1090519040 correspondingly. Result is displayed as 1677721600 instead of 200.
Please provide feedback on this.

回答 (1 件)

Muruganandham Subramanian
Muruganandham Subramanian 2013 年 5 月 28 日
編集済み: Muruganandham Subramanian 2013 年 5 月 28 日
Hi,
In fixedpoint operation, you might used scaling either binary point or slope and bias, So the value which you given as i/p(depends scaling value) and o/p (depends scaling value) should be divided finally.
e.g..
  • if you are giving 60 as i/p using binary point scaling to 2^30 will given as 64424509440 (scaled value).
So finally If you divide by the scaled value, you can get your expected result
i.e.
Exp.result=Actualresult/Scaled value
  3 件のコメント
RAVINDRANATH REDDY SUDA
RAVINDRANATH REDDY SUDA 2013 年 5 月 28 日
Thanks Muruganandham Subramanian
Muruganandham Subramanian
Muruganandham Subramanian 2013 年 5 月 29 日
If this answer helped you, Vote/Accept the answer..

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSimscape Electrical についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by