MATLAB Answers

Why is my signal builder not giving precise outputs?

37 ビュー (過去 30 日間)
I have a signal builder block with the following signal:
I connect my signal builder block to a "To Workspace" block.
I am using a fixed step solver with sample time of 0.05s. Hence, the output variable "simout" should contain the values of the signal at every Peak and Trough, that is, it should only contain 0's and 1's.
However, at certain time steps my output contains 0.999999999999999 instead of 1 and 1e-5 instead of 0.
Why is the output from my Signal Builder block not precise?

採用された回答

MathWorks Support Team
MathWorks Support Team 2018 年 3 月 9 日
By looking at "simout.Time" we can see that the time step taken by Simulink is slightly different than the time specified in the Signal Builder. This small value forces Simulink to interpolate between the specified point, leading to the small difference you see.
Following are two workarounds:
1. Specify your signal and time values as described in the following link:
2. Use the Signal Editor block in place of the signal builder block. This is a new block that covers some of the functionalities of the Signal Builder block and we would be interested to know if this addresses your needs.

  0 件のコメント

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

その他の回答 (2 件)

Naveen Venkata Krishnan
Naveen Venkata Krishnan 2019 年 12 月 19 日
This issue can be solved by using a signal editor block instead of signal builder block. The cause of the issue is because of interpolation and this option is not availbe in signal builder block.
Interestingly, it seems data from excel cannot be imported into signal editor block.
Hence we need to import data from excel into signal builder block convert it into signal editor block and uncheck interpolation in signal editor block. The below peice of code can be used to convert a signal builder block to signal editor block.
sbBlockH = [gcb]; % gcb is signal builder block path
seBlockH = signalBuilderToSignalEditor(sbBlockH,'Replace',true,'FileName','test2.mat');

  0 件のコメント

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


Ralph Youngs
Ralph Youngs 2020 年 3 月 2 日
Try increasing the Decimation and especially the Refine factor. I've needed a refine factor of 10 to recover ms precision in time domain data using the Signal Editor. Definitely check out the Scenario/Signal Editor block; it's much more useful than the signal builder.
To get to the refine factor >> Configuration Parameters>Data Import/Export>Additional parameters

  0 件のコメント

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

カテゴリ

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by