Simulink timeseries conversion into matrix

8 views (last 30 days)
Hello,
I have a timeseries of Y positon output from simulink block. Y in converging to the steady state from t = 0 to t =50. I want to calculate the root mean square deviation(RMSD) of every second of input Y while simulating and check when it drops below the set thrushhold of RMSD. How to create a matrix of elements for each second and calculate the RMSD. When thrushhold for RMSD is reached output from matlab function should be 1 else 0.
This is how I post processed the data after importing into matlab from simulink. The same has to be implemented in simulink.
time = Y_position.Data(3500:end,1);
v = Y_position.Data;
mean = 2.063;
a = (time + mean);
N = size(time);
for ii = 1:N
b(ii,1) =(a(ii,1) )^2;
sumb = sum(b);
end
c = sum(a);
MSE = sumb/N(1,1) % Mean square error (MSE)
RMSD_ = sqrt(MSE) % Root Mean square Deviation (RMSD)

Answers (0)

Categories

Find more on Simulink in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!