Clear Filters
Clear Filters

Create a Matlab Function that averages the input signal with the simulation running in the Simulink -- No upload to workspace

4 views (last 30 days)
I need to build a matlab function that is able to average the input signal over a specific time period.
In the signal below for example, I need the matlab function to calculate the average of the signal only in the time period from 0.05 to 0.07 s.
I cannot use the send to workspace feature (using to file or to workspace), I need to do this operation while the Simulink model is running.
I cannot use this send-to-workspace feature as it will be implemented physically.
I'm a beginner and I don't know how to start

Accepted Answer

Raghava S N
Raghava S N on 13 Jun 2023
Edited: Raghava S N on 13 Jun 2023
Hi,
Without knowing your harware target, this is the basic idea you need to implement.
The one-stop solution however is the mean block. This can be reset on a rising or falling edge. If you can extract the timestamp and trigger the mean block, you can implement the solution. What is the hardware target? Based on that the Simulink model can be designed.

More Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!