How make an equivalent function of unit delay in matlab

Hello,
I want to realise a average filter in simulink
The solution below work good, but the delay (5) is not a constant. it can be 10 or 20.
So i tried to make a matlab function in order to have this capability, but i cant find a proper delay function.
Have you got any ideas to perform this calculation?
Thanks a lot

Answers (1)

Delay block comes with its Input Port choice within the mask in its Source. Check the attached figures.

3 Comments

Baptiste's answer moved here:
Hello,
Thx but i found this feature and it do not fit.
I need to know the stats status at z^-5, z^-4 and so on and then add all the values in order to calcul the average.
With the block you mean, i only know the z^-5 value, thats all.
Any ideas?
Well, I did not understand clearly what you tried to do. I thought you want to continuously change the delay order throughout the simulation?
Ok i sum up.
i need to set a delay paramaters ( for ex : 180ms). Once the delay is set, i need to know the states @ z^-180 to z^-1
Then, i need to sum all this values and divide the results by the delay (180)
It's what i did on the simulink at the begining of the topic. It's work but the delay is a parameter. One time it can be 180ms and the other time it can be 30ms, and i need an adaptative calculation. I dont want to set a simulink with 180 delay block and next time 30 delay block...
I hope it is more understanding for you.

Sign in to comment.

Categories

Find more on Simulink in Help Center and File Exchange

Asked:

on 16 Apr 2018

Commented:

on 16 Apr 2018

Community Treasure Hunt

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

Start Hunting!