Double to fixpoint conversion of Sum and Discrete transfer function block
1 次查看(过去 30 天)
显示 更早的评论
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/151133/image.png)
0 个评论
回答(1 个)
Andrew Schenk
2015-6-15
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 HDL Coder 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!