MATLAB Answers

Fixed point tool conversion

2 views (last 30 days)
Giuseppe Galioto
Giuseppe Galioto on 21 Dec 2019
Answered: stozaki on 17 Jan 2020
Hi there,
How can I convert just a subsystem and not the entire model with the fixed point tool?
The tool, when I try to simulate, converts the overall system in fixed point, which is not my purpose.
Thanks in advance

  0 Comments

Sign in to comment.

Answers (2)

Asvin Kumar
Asvin Kumar on 26 Dec 2019
You can convert a particular subsystem to Fixed Point by selecting it under System Under Design while preparing the system. Check out the example at https://www.mathworks.com/help/releases/R2018a/fixedpoint/ug/tutorial-steps.html#bs4b8ai for more details.

  3 Comments

Giuseppe Galioto
Giuseppe Galioto on 4 Jan 2020
I select the subsystem I want to convert in System Under Design, but when I go through the steps and click on Simulate with embedded types, "sometimes" the tool converts the whole system. I don't know why this happens and it is undesirable since the rest of the system apart of the subsystem considered is inherently continuous and I don't want to convert it.
Asvin Kumar
Asvin Kumar on 6 Jan 2020
I see. Is there any way you know to reproduce this issue? So that I can check it out on my end. Or anyone else from the community can confirm.
Evangelos Denaxas
Evangelos Denaxas on 15 Jan 2020
What could be happening here is that fixed-point leaks out from the system under design by following data type propagation rules. So things that outside your system under design are not "converted" per se but rather propagating the data types they get as input. In order to avoid any of these unexpected issues you may want to properly isolate your system under design with a block called "data type converter". If you put one of these blocks to each line going in and out of your SUD then you'll minimize the chances of fixed-point trickling outside your system.

Sign in to comment.


stozaki
stozaki on 17 Jan 2020
Please try following script.
model = 'modelName'; % define your model name
sud = [model '/sud']; % define system under design as sybsystem block path
opt = fxpOptimizationOptions(); % Specify options for data type optimization
allowableWL = (10:20); % set allow word length
opt.AllowableWordLengths = allowableWL;
tol = 0.1; % define tolerance
opt.addTolerance([model '/diff'], 1, 'AbsTol', tol); % set tolerance
opt.addTolerance([model '/diff'], 2, 'AbsTol', tol); % set tolerance
opt.UseParallel = false;
optRes = fxpopt(model, sud, opt); % execute
Regards,
Shuhei

  0 Comments

Sign in to comment.