Trouble understanding the Flip block in Simulink

2 visualizaciones (últimos 30 días)
Rafael Cordero
Rafael Cordero el 16 de Jun. de 2020
Comentada: Rafael Cordero el 17 de Jun. de 2020
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!
R

Respuestas (1)

Jonas
Jonas el 17 de Jun. de 2020
Editada: Jonas el 17 de Jun. de 2020
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 comentario
Rafael Cordero
Rafael Cordero el 17 de Jun. de 2020
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.

Iniciar sesión para comentar.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by