# How can I calculate value of a signal (using MATLAB Function block of Simulink) between two time instants i.e. between 5.04 s to 5.25 s?

4 Ansichten (letzte 30 Tage)
Taimoor Khan Mehmand am 14 Dez. 2022
Kommentiert: Mathieu NOE am 2 Jan. 2023
Actually I have a signal (figure attached) which is a frequency signal and that signal would be input to the " MATLAB Function block of Simulink" . So this input signal is not a vector, it is just a one dimension signal of 50Hz value and the value changes at 5 seconds because there is a disturbance event at 5 seconds. So eventually , I want to find the value between 5.04s to 5.25s (which is actually the rate of change of this signal between 5.04s to 5.25s). Also I don't know how many samples do I need to take between 5.04s to 5.25s in order to have accurate rate of change of this signal. Can anyone please guide or anyone have any idea how to do this using MATLAB Function block of the Simulink?
##### 1 KommentarKeine anzeigenKeine ausblenden
Mathieu NOE am 2 Jan. 2023
hello
why not using a buffer block to store the samples (for a duration of 0.2 s) then use the math block with mean(diff(u))
NB : your solver must use fixed time steps dt
the output of the math block then needs to be divided by dt to get the average slope of the frequency signal
a simpler alternative (IMHO) is to use a first order high pass filter (used as a frequency limited derivator).

Melden Sie sich an, um zu kommentieren.

### Kategorien

Find more on Signal Generation in Help Center and File Exchange

R2020b

### Community Treasure Hunt

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

Start Hunting!