MATLAB Answers

Trouble understanding the Flip block in Simulink

2 ビュー (過去 30 日間)
Rafael Cordero
Rafael Cordero 2020 年 6 月 16 日
コメント済み: Rafael Cordero 2020 年 6 月 17 日
Hello world!
New to Simulink. Did a bunch of tutorials, now trying some projects.
I'm having some problems with the 'Flip' block of the DSP system toolbox. Lets say I have an input vector v where:
v = [0 1 0 1 0 0 0 1 1 0 1 1 1 2 1 2 2 2 1 2 1 3 3 2 1 1 2 3 2 3 3 2 3 3 3 2 2 2 1 0 0 0 -1 -1 -1 -2 -1 -1 -2 0 -1 0 -1 0 0 0]'; % Arbitrary real column vector
And its corresponding time vector t where:
t = (0:1:length(v)-1)'; % Time column vector
I then imported them into the following Simulink model via the data import/export tab in the model configuration parameters settings:
Me flip block is flipping along columns.
So I would have thought that the scope would show me the original signal v, and a left-to-right flipped version of the original signal. Instead I get that both are the exact same:
Questions: - Why is this happening?
- How would I get a left-right flipped version of the input signal?
I tried looking at the documentation but it didnt really help too much.
Bonus question: - All of this was because I want to implement filtfilt in Simulink but for some reason (as other people have asked) it doesn't work when you do it via a Matlab function call block. So if anyone has any pointers on that I'd be super grateful.
Thank you!

  0 件のコメント


回答 (1 件)

Jonas 2020 年 6 月 17 日
編集済み: Jonas 2020 年 6 月 17 日
When you are importing a data vector in your Simulink model, it reads the data vector one by one, sample by sample and executes the Simulink model's operations on each sample separately. Simulink is a time-based or sample-based simulation tool. Your vector 'v' is not read in its interity.
This means that what is going in your 'flip' block is a single value. Flipping a single value results in the same value again.

  1 件のコメント

Rafael Cordero
Rafael Cordero 2020 年 6 月 17 日
Ahhh, I understand. Thank you. In that case, is it possible to send the entire vector 'v' to the flip block rather than sample by sample? I tried using the buffer block but wasnt succesfuly.


Community Treasure Hunt

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

Start Hunting!

Translated by