From: XiShi ? on
Consider a very simple model.
Given a Sine Wave block and a Embedded MATLAB Function block, I want do something like smoothing the input signal. Therefore, I need process the output of the sine wave block in the different times, for instance, x(n-1),x(n),x(n+1), in the function block.
However, I can only access the current input x(n) in the function block, and how to access the last data x(n-1) or earilers? How to save the sequence and load it again?
From: Navan Ruthramoorthy on
"XiShi ?" <xd7688(a)hotmail.com> wrote in message <i18s4o$emk$1(a)fred.mathworks.com>...
> Consider a very simple model.
> Given a Sine Wave block and a Embedded MATLAB Function block, I want do something like smoothing the input signal. Therefore, I need process the output of the sine wave block in the different times, for instance, x(n-1),x(n),x(n+1), in the function block.
> However, I can only access the current input x(n) in the function block, and how to access the last data x(n-1) or earilers? How to save the sequence and load it again?

Hi,

You can use persistent variables in Embedded MATLAB to store values between function calls. You can also the Integer Delay block in Simulink to delay a signal and get x(n-1).

Navan