mvstat

Version 1.0.0.0 (2.88 KB) by Aubai
This file can be used to calculate the moving:mean,max,min,sum,rms,int of an input vector
762 Downloads
Updated 10 Sep 2013

View License

This file is created to calculate the mathematical operation like 'max' on a pre-defined window range and with a pre-defined reduction range of an vector data.
This function will need the following inputs in order to calculate the wished results:
1- Inputdata_signal: A vector containg your Y-Values that need to be
filtered.
2- Inputdata_time: A vector containg your x-Values that need to be
filtered (Normally is a time signal where the sampling rate can be
extracted).
3- windowrange: in unit of time (s) is the range to calculate the needed
mathematical function (The moving range ex. mvmean(y,x,0.02,0.02) or mvrms(y,x,0.02,0.02))
4- reductionrange: in unit of time (s) is the scalling reference for
the new data
5- fn : is used to define the wished mathmatical operation (ex. @max, @min, @mean, @rms, @int)
%The relation between the windowrange input and the reductionrange input
%must be an integer value of 1:1.2:1..10:1. If not the reductionrange would
be corrected to get one of those relation. this specification give us the
possibility to calculate the 'mvstat_final' without using a for-Loop which will save a whole amount of time
for example:
fn = @mean
[output_signal,out_put_time] = mvstat_final (y,x,10,10)
the moving average will be calculated as a result of this function. every
10 s the mean value for the last 10 s will be calculated.
fn = @max
[output_signal,out_put_time] = mvstat_final (y,x,20,10)
the moving max will be calculated as a result of this function. every
10 s the maximum value for the last 20 s will be calculated.
fn = @min
[output_signal,out_put_time] = mvstat_final (y,x,5,10)
the moving min will be calculated as a result of this function. every
10 s the minmum value for the last 5 s will be calculated.
Notice: when the input values of windowrange and reductionrange are not
the same then at the beginning of the calculation the fn value of the a
available data will be calculated.
Is m.file will also allows you to calculate the intgration of your input
data in a spesific windowrange. in this case the reductionrange input
should be defined as in the example:
fn = @int;
[Ua_sin,Ua_sin_time] = mvstat(Ua_sin,U1_time,(1/f_grid),delta_t,fn); Ua_sin = Ua_sin*2*f_grid;
in this example the integration of your input data (in this case U1_sin)
will be calculated ever one period (normally this mean 0.02 s or 1/50 or
1/f_grid in our case). and then the reductionrange is in this case equal
to the sampling time of the inputdata (delta = U1_time(2)-U1_time(1)).
this work was done in order to bring FAMOS (IMC) software function into
matlab.
Auther: Msc.Eng. Aubai Alkhatib
Datum: 10.09.2013

Cite As

Aubai (2024). mvstat (https://www.mathworks.com/matlabcentral/fileexchange/43440-mvstat), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Develop uifigure-Based Apps in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0.0