Double to fixpoint conversion of Sum and Discrete transfer function block
1 view (last 30 days)
Show older comments
Hi, this model works fine with data types shown
for summer (input1 : ufix6_En7, input2: ufixe6_En6, output : double) and
Discrete TF.. (output: double)
but when i change the sum block output to any fix point it does not give the correct results. what should be the correct method So that I can convert all these to fixed point so that HDL code can be generated.
- Do we need to insert ZOH block prior to conversion , or some fix point tool will insert where necessary.
- what should be the fix point settings for Discrete TF block
- what does the wire color shows,,, when I update diagram it turns to red
- for above both blocks ,, how to set the Accumulator/ ouput data type settings..
Thank you
0 Comments
Answers (1)
Andrew Schenk
on 15 Jun 2015
It is best practice to insert a ZOH block after the input port to the model as it will convert an input signal with continuous sample time to an output signal with a discrete sample time.
The reason you are getting incorrect results is likely because the fixed point data type has not been selected correctly for your specific signal data range. If you use the Simulink Menu Bar -> Analysis -> Fixed Point Tool utility, this will simulate your model, derive signal ranges, and automatically propose data types that prevent over/underflow errors while maximizing resolution.
Finally, the blocks are colored red to indicate the particular sample time. This can be changed by clicking: Display -> Sample Time -> Off. Also, click Display -> Sample Time -> Display Sample Time Legend will pop-up a window describing the meaning of each color.
See Also
Categories
Find more on HDL Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!